lorax-composer: pass customization.kernel append to extra_boot_args
This allows iso builds to include the extra kernel boot parameters by passing them to the arch-specific live/*tmpl template. Also adds tests to make sure it is written to config.toml in the build metadata. Resolves: rhbz#1688335
This commit is contained in:
parent
9cebd1ddaf
commit
0b8a5ac87c
@ -19,7 +19,7 @@ BuildRequires: python2-devel
|
||||
BuildRequires: python-sphinx yum python-mako pykickstart
|
||||
BuildRequires: python-flask python-gobject libgit2-glib python2-pytoml python-semantic_version
|
||||
|
||||
Requires: lorax >= 19.7.20
|
||||
Requires: lorax >= 19.7.22
|
||||
Requires(pre): /usr/bin/getent
|
||||
Requires(pre): /usr/sbin/groupadd
|
||||
Requires(pre): /usr/sbin/useradd
|
||||
|
@ -147,6 +147,21 @@ def bootloader_append(line, kernel_append):
|
||||
return str(ks.handler.bootloader).splitlines()[-1]
|
||||
|
||||
|
||||
def get_kernel_append(recipe):
|
||||
"""Return the customizations.kernel append value
|
||||
|
||||
:param recipe:
|
||||
:type recipe: Recipe object
|
||||
:returns: append value or empty string
|
||||
:rtype: str
|
||||
"""
|
||||
if "customizations" not in recipe or \
|
||||
"kernel" not in recipe["customizations"] or \
|
||||
"append" not in recipe["customizations"]["kernel"]:
|
||||
return ""
|
||||
return recipe["customizations"]["kernel"]["append"]
|
||||
|
||||
|
||||
def customize_ks_template(ks_template, recipe):
|
||||
""" Customize the kickstart template and return it
|
||||
|
||||
@ -158,11 +173,9 @@ def customize_ks_template(ks_template, recipe):
|
||||
Apply customizations.kernel.append to the bootloader argument in the template.
|
||||
Add bootloader line if it is missing.
|
||||
"""
|
||||
if "customizations" not in recipe or \
|
||||
"kernel" not in recipe["customizations"] or \
|
||||
"append" not in recipe["customizations"]["kernel"]:
|
||||
kernel_append = get_kernel_append(recipe)
|
||||
if not kernel_append:
|
||||
return ks_template
|
||||
kernel_append = recipe["customizations"]["kernel"]["append"]
|
||||
found_bootloader = False
|
||||
output = StringIO()
|
||||
for line in ks_template.splitlines():
|
||||
@ -465,6 +478,7 @@ def start_build(cfg, yumlock, gitlock, branch, recipe_name, compose_type, test_m
|
||||
cfg_args["project"] = os_release.get("NAME")
|
||||
cfg_args["releasever"] = os_release.get("VERSION_ID")
|
||||
cfg_args["volid"] = ""
|
||||
cfg_args["extra_boot_args"] = get_kernel_append(recipe)
|
||||
|
||||
cfg_args.update({
|
||||
"compression": "xz",
|
||||
|
@ -1082,6 +1082,12 @@ class ServerTestCase(unittest.TestCase):
|
||||
self.assertTrue("network --hostname=" in final_ks)
|
||||
self.assertTrue("sshkey --user root" in final_ks)
|
||||
|
||||
# Examine the config.toml to make sure it has an empty extra_boot_args
|
||||
cfg_path = joinpaths(self.repo_dir, "var/lib/lorax/composer/results/", build_id, "config.toml")
|
||||
cfg_dict = toml.loads(open(cfg_path, "r").read())
|
||||
self.assertTrue("extra_boot_args" in cfg_dict)
|
||||
self.assertEqual(cfg_dict["extra_boot_args"], "")
|
||||
|
||||
# Delete the finished build
|
||||
# Test the /api/v0/compose/delete/<uuid> route
|
||||
resp = self.server.delete("/api/v0/compose/delete/%s" % build_id)
|
||||
@ -1235,6 +1241,12 @@ class ServerTestCase(unittest.TestCase):
|
||||
self.assertNotEqual(bootloader_line, "", "No bootloader line found")
|
||||
self.assertTrue("nosmt=force" in bootloader_line)
|
||||
|
||||
# Examine the config.toml to make sure it was written there as well
|
||||
cfg_path = joinpaths(self.repo_dir, "var/lib/lorax/composer/results/", build_id, "config.toml")
|
||||
cfg_dict = toml.loads(open(cfg_path, "r").read())
|
||||
self.assertTrue("extra_boot_args" in cfg_dict)
|
||||
self.assertEqual(cfg_dict["extra_boot_args"], "nosmt=force")
|
||||
|
||||
def assertInputError(self, resp):
|
||||
"""Check all the conditions for a successful input check error result"""
|
||||
data = json.loads(resp.data)
|
||||
|
Loading…
Reference in New Issue
Block a user