mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Decode git call output in Python 3
The subprocess communicate() method returns byte streams for stdout and stderr in Python 3. They need to be decoded to str. Otherwise the version string parsing will fail: Traceback (most recent call last): File "salt/version.py", line 522, in __discover_version return SaltStackVersion.parse(out) File "salt/version.py", line 267, in parse 'Unable to parse version string: \'{0}\''.format(version_string) ValueError: Unable to parse version string: 'b'c0e6782d''
This commit is contained in:
parent
693f72d5a7
commit
217183405a
@ -512,6 +512,9 @@ def __discover_version(saltstack_version):
|
||||
process = subprocess.Popen(
|
||||
['git', 'describe', '--tags', '--match', 'v[0-9]*', '--always'], **kwargs)
|
||||
out, err = process.communicate()
|
||||
if six.PY3:
|
||||
out = out.decode()
|
||||
err = err.decode()
|
||||
out = out.strip()
|
||||
err = err.strip()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user