maas/images/maas-region-controller/2.3_kernel_package.patch
Alan Meadows 037bde9934 bugfix: Ensure kernel_package param is not required
A previous patchset introduced a new kernel
param option 'kernel_package.' This patch corrects
the logic in that so that the parameter is not a
required parameter - and if absent falls back to
the traditional MaaS behavior which will select the
latest kernel from the appropriate line.

Change-Id: Icc62b27e0f39914fb73fb9f655d9b7b0b6c6f489
2018-10-19 07:56:18 -07:00

29 lines
1.2 KiB
Diff

--- preseed.py 2018-10-15 12:52:41.611027184 -0700
+++ preseed2.py 2018-10-19 07:26:10.985282758 -0700
@@ -317,7 +317,25 @@
The BootResourceFile table contains a mapping between hwe kernels and
Ubuntu package names. If this mapping is missing we fall back to letting
Curtin figure out which kernel should be installed"""
+
+ # previous logic to retrieve kpackage parameter
kpackage = BootResource.objects.get_kpackage_for_node(node)
+
+ # determine if this node has kernel parameters applied by drydock
+ # and override kpackage if we discover the right properties
+ kernel_opt_tag = "%s_kp" % (node.hostname)
+ if kernel_opt_tag in node.tag_names():
+
+ # the tag exists, retrieve it
+ kernel_opts = node.tags.get(name=kernel_opt_tag).kernel_opts
+
+ # parse the string and find our package param value
+ # e.g. kernel_package=linux-image-4.15.0-34-generic
+ kparams = kernel_opts.split()
+ kdict = dict(kparam.split('=') for kparam in kparams)
+ if 'kernel_package' in kdict:
+ kpackage = kdict['kernel_package']
+
if kpackage:
kernel_config = {
'kernel': {