fix bytes or str in find command

The subprocess command with communicate and encode() sometimes comes back
either a string or bytes. No sure why but to fix this just check output
and change all str to bytes.
This commit is contained in:
psyer 2018-03-14 13:03:47 -04:00
parent 0877cfc38f
commit e8d3d017f9

View file

@ -448,6 +448,10 @@ def _run(cmd,
).communicate(py_code.encode(__salt_system_encoding__))
env_encoded_err = env_encoded[1]
env_encoded = env_encoded[0]
if isinstance(env_encoded_err,str):
env_encoded_err = env_encoded_err.encode(__salt_system_encoding__)
if isinstance(env_encoded,str):
env_encoded = env_encoded.encode(__salt_system_encoding__)
env_encoded_org = env_encoded
env_mark = env_encoded.find(marker_b + b'\n')
if env_mark < 0: