From eb7cc2cbac7fe31712b7a0be53b11e6b201d1051 Mon Sep 17 00:00:00 2001 From: Albert Date: Thu, 28 Jul 2016 12:46:21 +0300 Subject: [PATCH] Fix for the issue with mangling kernel options (flags) during editing profile with the --in-place key --- cobbler/tftpgen.py | 1 + cobbler/utils.py | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/cobbler/tftpgen.py b/cobbler/tftpgen.py index df949d67ad..d72d588f5d 100644 --- a/cobbler/tftpgen.py +++ b/cobbler/tftpgen.py @@ -651,6 +651,7 @@ def build_kernel_options(self, system, profile, distro, image, arch, append_line = "" kopts = blended.get("kernel_options", dict()) + kopts = utils.revert_strip_none(kopts) # since network needs to be configured again (it was already in netboot) when kernel boots # and we choose to do it dinamically, we need to set 'ksdevice' to one of diff --git a/cobbler/utils.py b/cobbler/utils.py index 0bacf82fb5..3e04d13eff 100644 --- a/cobbler/utils.py +++ b/cobbler/utils.py @@ -1947,6 +1947,28 @@ def strip_none(data, omit_none=False): return data # ------------------------------------------------------- +def revert_strip_none(data): + """ + Does the opposite to strip_none + """ + if isinstance(data, str) and data.strip() == '~': + return None + + if isinstance(data, list): + data2 = [] + for x in data: + data2.append(revert_strip_none(x)) + return data2 + + if isinstance(data, dict): + data2 = {} + for key in data.keys(): + data2[key] = revert_strip_none(data[key]) + return data2 + + return data + +# ------------------------------------------------------- def lod_to_dod(_list, indexkey):