summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn L. Villalovos <jvillalovos@amperecomputing.com>2019-11-27 18:56:55 -0500
committerMartin Styk <mastyk@redhat.com>2020-03-19 10:33:25 +0000
commit11831c548818bfec248bacb051f381f4800041b0 (patch)
treeaacd382dec339a5db24abc64105fa29ed90434b1
parent21fe3ae524beea144ea9e6e79a4937367a9e1b0f (diff)
Add support for a 'ks_keyword' variable to 'ks_meta' attribute
Add a new 'ks_meta' variable 'ks_keyword'. This can be used to change the default kickstart keyword from 'ks' to something else. For example to support Debian can use: ks_meta="ks_keyword=preseed/url' Then normal template processing will occur but instead of the kernel command line argument being like: ks=http://example.com/kickstart/23 It would be: preseed/url=http://example/com/kickstart/23 If a user were to use this then an appropriate preseed template would need to be put into /etc/beaker/kickstarts/ on the beaker server. For example for Ubuntu would create the preseed Jinja2 file in /etc/beaker/kickstarts/Ubuntu. For Debian it would be /etc/beaker/kickstarts/Debian. Bug: 1795917 Change-Id: I43a9b10be6122d51f164d689112530e2c9d474d1
-rw-r--r--IntegrationTests/src/bkr/inttest/server/test_model.py16
-rw-r--r--Server/bkr/server/model/scheduler.py7
-rw-r--r--documentation/user-guide/customizing-installation.rst25
3 files changed, 39 insertions, 9 deletions
diff --git a/IntegrationTests/src/bkr/inttest/server/test_model.py b/IntegrationTests/src/bkr/inttest/server/test_model.py
index d69e9e9..c214ebf 100644
--- a/IntegrationTests/src/bkr/inttest/server/test_model.py
+++ b/IntegrationTests/src/bkr/inttest/server/test_model.py
@@ -1383,12 +1383,24 @@ class DistroTreeTest(DatabaseTestCase):
self.assertRaises(ValueError, lambda: distro_tree.url_in_lab(
self.lc, scheme=['http', 'nfs'], required=True))
- def provision_distro_tree(self, distro_tree):
- recipe = data_setup.create_recipe(distro_tree=distro_tree)
+ def provision_distro_tree(self, distro_tree, ks_meta=None):
+ recipe = data_setup.create_recipe(distro_tree=distro_tree, ks_meta=ks_meta)
data_setup.create_job_for_recipes([recipe])
data_setup.mark_recipe_waiting(recipe, lab_controller=self.lc)
return recipe
+ def test_ksmeta_ks_keyword(self):
+ # Test that the 'ks_keyword' variable when put in the ks_meta attribute
+ # changes the name of the value used to specify the kickstart.
+ distro_rhel6 = data_setup.create_distro(osmajor=u'RedHatEnterpriseLinux6',
+ osminor=u'5')
+ rhel6_ppc64 = data_setup.create_distro_tree(distro=distro_rhel6,
+ arch=u'ppc64')
+ r1 = self.provision_distro_tree(rhel6_ppc64, ks_meta="ks_keyword=preseed/url")
+ self.assertIn('preseed/url=http://', r1.installation.kernel_options)
+ self.assertNotIn('ks=', r1.installation.kernel_options)
+
+
def test_custom_netbootloader(self):
# ppc64, RHEL 6
diff --git a/Server/bkr/server/model/scheduler.py b/Server/bkr/server/model/scheduler.py
index d135dda..90ece6c 100644
--- a/Server/bkr/server/model/scheduler.py
+++ b/Server/bkr/server/model/scheduler.py
@@ -2645,7 +2645,8 @@ class Recipe(TaskBase, ActivityMixin):
if 'no_default_harness_repo' not in install_options.ks_meta \
and not self.harness_repo():
raise ValueError('Failed to find repo for harness')
- if 'ks' in install_options.kernel_options:
+ ks_keyword = install_options.ks_meta.get('ks_keyword', 'ks')
+ if ks_keyword in install_options.kernel_options:
# Use it as is
rendered_kickstart = None
elif self.kickstart:
@@ -2705,7 +2706,7 @@ class Recipe(TaskBase, ActivityMixin):
system=getattr(self.resource, 'system', None),
user=self.recipeset.job.owner,
recipe=self, kickstart=kickstart)
- install_options.kernel_options['ks'] = rendered_kickstart.link
+ install_options.kernel_options[ks_keyword] = rendered_kickstart.link
else:
ks_appends = [ks_append.ks_append for ks_append in self.ks_appends]
rendered_kickstart = generate_kickstart(install_options=install_options,
@@ -2713,7 +2714,7 @@ class Recipe(TaskBase, ActivityMixin):
system=getattr(self.resource, 'system', None),
user=self.recipeset.job.owner,
recipe=self, ks_appends=ks_appends)
- install_options.kernel_options['ks'] = rendered_kickstart.link
+ install_options.kernel_options[ks_keyword] = rendered_kickstart.link
self.installation.kernel_options = install_options.kernel_options_str
self.installation.rendered_kickstart = rendered_kickstart
diff --git a/documentation/user-guide/customizing-installation.rst b/documentation/user-guide/customizing-installation.rst
index 102ebb5..1dfcc7c 100644
--- a/documentation/user-guide/customizing-installation.rst
+++ b/documentation/user-guide/customizing-installation.rst
@@ -103,11 +103,18 @@ The following kernel options are treated specially by Beaker:
.. _kickstart-metadata:
-Kickstart metadata
-~~~~~~~~~~~~~~~~~~
+Kickstart metadata (ks_meta)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The following variables are supported and can be selected by placing them in
+the ``ks_meta`` attribute in the ``recipe`` element. In many cases, these
+variables correspond to the similarly-named kickstart option.
-The following variables are supported. In many cases, these variables
-correspond to the similarly-named kickstart option.
+For example in the job XML::
+
+ ...
+ <recipe kernel_options="" kernel_options_post="" ks_meta="harness=restraint hwclock_is_utc" role="None" whiteboard="Lab Controller">
+ ...
``auth=<authentication configuration options>``
Authentication configuration to use. For example,
@@ -277,6 +284,16 @@ correspond to the similarly-named kickstart option.
``keyboard=<layout>``
Keyboard layout to use. Default is ``us``.
+``ks_keyword``
+ Change the normal kickstart kernel command line keyword from 'ks' to user
+ specified value. This can be useful for instance if wanting to install an
+ operating system like Debian. Could do ``ks_keyword=preseed`` and then the
+ kickstart file will be generated but on kernel command it would be present
+ as ``preseed=http://example.com/kickstart/18`` as an example. A custom
+ preseed template will need to be created and put in
+ ``/etc/beaker/kickstarts/``. For example if doing a Debian install the
+ file ``/etc/beaker/kickstarts/Debian`` should be created.
+
``lang=<localeid>``
Locale to use. Default is ``en_US.UTF-8``.