rundeck-plugins / kubernetes

52 stars 59 forks source link

Ignore non ascii chars that cant be encoded for prints #122

Closed GuyCarmy closed 2 years ago

GuyCarmy commented 2 years ago

If there is a non ascii char, the plugin breaks with the error below and fails the rundeck job. this fix will skip the print of the char, but probably most of the log will still be usable and its better than current behaviour.

in my case it was the char µ, but it can happen with other chars too.


  File "/var/lib/rundeck/libext/cache/kubernetes-plugin-2.0.5-SNAPSHOT/job-wait.py", line 148, in <module>
    main()
  File "/var/lib/rundeck/libext/cache/kubernetes-plugin-2.0.5-SNAPSHOT/job-wait.py", line 144, in main
    wait()
  File "/var/lib/rundeck/libext/cache/kubernetes-plugin-2.0.5-SNAPSHOT/job-wait.py", line 111, in wait
    print(line)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xb5' in position 11568: ordinal not in range(128)
Failed: NonZeroResultCode: Script result code was: 1
Execution failed: 9117 in project xxx: [Workflow result: , step failures: {2=Dispatch failed on 1 nodes: [localhost: NonZeroResultCode: Script result code was: 1 + {dataContext=MultiDataContextImpl(map={}, base=null)} ]}, Node failures: {localhost=[NonZeroResultCode: Script result code was: 1 + {dataContext=MultiDataContextImpl(map={}, base=null)} ]}, status: failed]```
GuyCarmy commented 2 years ago

this fixes #108 @ltamaster please review when you have a second (and I also have another tiny PR open).

GuyCarmy commented 2 years ago

Hi @ltamaster any chance you will be able to review that?

ltamaster commented 2 years ago

Hi @GuyCarmy I will try to review it this week Luis