cobbler/pxegen.py | 1 + cobbler/utils.py | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/cobbler/pxegen.py b/cobbler/pxegen.py index a9a5940..fbc0743 100644 --- a/cobbler/pxegen.py +++ b/cobbler/pxegen.py @@ -775,6 +775,7 @@ class PXEGen: append_line = "" kopts = blended.get("kernel_options", dict()) + kopts = utils.revert_strip_none(kopts) # support additional initrd= entries in kernel options. if "initrd" in kopts: append_line = ",%s" % kopts.pop("initrd") diff --git a/cobbler/utils.py b/cobbler/utils.py index fa6b534..56d21e6 100644 --- a/cobbler/utils.py +++ b/cobbler/utils.py @@ -2194,6 +2194,27 @@ 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 cli_find_via_xmlrpc(remote, otype, options): """ Given an options object and a remote handle, find options matching