mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-04 23:44:00 -07:00
Normalize text and byte type in the ssh plugin helper method that builds up an ssh command (#17860)
Mostly cleanups to make the code more efficient, more pythonic, and obey the unicode sandwich strategy more but also Fixes #17832
This commit is contained in:
parent
b0cd624aef
commit
64c446d9c0
3 changed files with 72 additions and 58 deletions
|
@ -140,6 +140,7 @@ class ConnectionBase(with_metaclass(ABCMeta, object)):
|
|||
# ['t\x00\x00\x00', '\x00\x00\x00e\x00\x00\x00']
|
||||
return [to_text(x.strip()) for x in shlex.split(to_bytes(argstring)) if x.strip()]
|
||||
except AttributeError:
|
||||
# In Python3, shlex.split doesn't work on a byte string.
|
||||
return [to_text(x.strip()) for x in shlex.split(argstring) if x.strip()]
|
||||
|
||||
@abstractproperty
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue