Fixup print function usage with StringIO

Related: rhbz#1688335
This commit is contained in:
Brian C. Lane 2019-03-18 13:39:31 -07:00
parent 0b8a5ac87c
commit e988b8e7d6

View File

@ -30,6 +30,7 @@ compose_args should have a name matching the kickstart, and it should set the no
parameters needed to generate the desired output. Other types should be set to False. parameters needed to generate the desired output. Other types should be set to False.
""" """
from __future__ import print_function
import logging import logging
log = logging.getLogger("lorax-composer") log = logging.getLogger("lorax-composer")
@ -180,11 +181,11 @@ def customize_ks_template(ks_template, recipe):
output = StringIO() output = StringIO()
for line in ks_template.splitlines(): for line in ks_template.splitlines():
if not line.startswith("bootloader"): if not line.startswith("bootloader"):
print(line, file=output) print(line.decode("utf-8"), file=output)
continue continue
found_bootloader = True found_bootloader = True
log.debug("Found bootloader line: %s", line) log.debug("Found bootloader line: %s", line)
print(bootloader_append(line, kernel_append), file=output) print(bootloader_append(line, kernel_append).decode("utf-8"), file=output)
if found_bootloader: if found_bootloader:
return output.getvalue() return output.getvalue()