mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
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:
parent
0877cfc38f
commit
e8d3d017f9
1 changed files with 4 additions and 0 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Reference in a new issue