Skip to content

Commit

Permalink
Merge pull request cobbler#1682 from ASyriy/master
Browse files Browse the repository at this point in the history
Fix for the issue with mangling kernel options (flags) with the --in-place key
  • Loading branch information
jmaas authored Sep 24, 2016
2 parents e4c8033 + eb7cc2c commit 299569d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions cobbler/tftpgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 22 additions & 0 deletions cobbler/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 299569d

Please sign in to comment.