Fix logrotate postrotate command
[packages/centos7/cobbler.git] / Mirantis-mangling-kopts-bugfix.patch
1 cobbler/pxegen.py |  1 +
2  cobbler/utils.py  | 21 +++++++++++++++++++++
3  2 files changed, 22 insertions(+)
4
5 diff --git a/cobbler/pxegen.py b/cobbler/pxegen.py
6 index a9a5940..fbc0743 100644
7 --- a/cobbler/pxegen.py
8 +++ b/cobbler/pxegen.py
9 @@ -775,6 +775,7 @@ class PXEGen:
10  
11          append_line = ""
12          kopts = blended.get("kernel_options", dict())
13 +        kopts = utils.revert_strip_none(kopts)
14          # support additional initrd= entries in kernel options.
15          if "initrd" in kopts:
16              append_line = ",%s" % kopts.pop("initrd")
17 diff --git a/cobbler/utils.py b/cobbler/utils.py
18 index fa6b534..56d21e6 100644
19 --- a/cobbler/utils.py
20 +++ b/cobbler/utils.py
21 @@ -2194,6 +2194,27 @@ def strip_none(data, omit_none=False):
22  
23      return data
24  
25 +def revert_strip_none(data):
26 +    """
27 +    Does the opposite to strip_none
28 +    """
29 +    if isinstance(data, str) and data.strip() == '~':
30 +        return None
31 +
32 +    if isinstance(data, list):
33 +        data2 = []
34 +        for x in data:
35 +            data2.append(revert_strip_none(x))
36 +        return data2
37 +
38 +    if isinstance(data, dict):
39 +        data2 = {}
40 +        for key in data.keys():
41 +            data2[key] = revert_strip_none(data[key])
42 +        return data2
43 +
44 +    return data
45 +
46  def cli_find_via_xmlrpc(remote, otype, options):
47      """
48      Given an options object and a remote handle, find options matching