Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not use decode on subprocess.check_output
The argument universal_newlines is passed in which means it returns strings rather than bytes. That means there is no decode(). Output with Python 3.7.5 as /usr/bin/python before this patch: [WARNING]: * Failed to parse /home/ekohl/dev/forklift/inventories/vagrant.py with script plugin: Inventory script (/home/ekohl/dev/forklift/inventories/vagrant.py) had an execution error: Traceback (most recent call last): File "/home/ekohl/dev/forklift/inventories/vagrant.py", line 119, in <module> main() File "/home/ekohl/dev/forklift/inventories/vagrant.py", line 111, in main hosts = list_running_hosts() File "/home/ekohl/dev/forklift/inventories/vagrant.py", line 52, in list_running_hosts hosts = list(get_running_hosts()) File "/home/ekohl/dev/forklift/inventories/vagrant.py", line 39, in get_running_hosts status = subprocess.check_output(cmd.split(), universal_newlines=True).decode().rstrip() AttributeError: 'str' object has no attribute 'decode'
- Loading branch information