Use universal_newlines with subprocess.check_output
Python 3 will complain when trying to split a byte-string using a string so this change enables universal_newlines to make the split work in both python 2 and 3. Also add a py3 tox environment. Change-Id: I9af74b6c6cc9cfd0c973c85be04791aa6dc0acd4
This commit is contained in:
parent
0762fcb0b5
commit
cb171db770
|
@ -147,7 +147,7 @@ def all_block_devices():
|
||||||
'''Run blkid and yield a BlockDevice for all devices.'''
|
'''Run blkid and yield a BlockDevice for all devices.'''
|
||||||
try:
|
try:
|
||||||
cmd = ['blkid', '-o', 'export']
|
cmd = ['blkid', '-o', 'export']
|
||||||
out = subprocess.check_output(cmd)
|
out = subprocess.check_output(cmd, universal_newlines=True)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error('Problem running "%s": %s', ' '.join(cmd), e)
|
logger.error('Problem running "%s": %s', ' '.join(cmd), e)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue