Decode string to bytes in dracut-regenerate

In python3, the standard out data returned by
subprocess.Popen.communicate() will in most cases be bytes rather than a
string and must therefore be decoded.

Without this fix we hit the following error:

TypeError: a bytes-like object is required, not 'str'

Change-Id: I6d75f867ebfdb925970c3397175214b9050d7632
Closes-Bug: #1694463
This commit is contained in:
Mark Goddard 2017-05-30 15:57:57 +01:00
parent 634e9ac043
commit aa6c1d01a9

View File

@ -51,7 +51,7 @@ def main():
e.output = out e.output = out
raise e raise e
kernel_set = out.split(':') kernel_set = out.decode().split(':')
kernel_search = re.match("vmlinuz-(.*)", kernel_set[0]) kernel_search = re.match("vmlinuz-(.*)", kernel_set[0])
kernel_version = "%s" % kernel_search.groups(1) kernel_version = "%s" % kernel_search.groups(1)
ramdisk_path = "/boot/%s" % kernel_set[1].strip() ramdisk_path = "/boot/%s" % kernel_set[1].strip()