]> review.fuel-infra Code Review - packages/centos7/cobbler.git/commitdiff
Fix for mangling kernel options when the key --in-place is used. LP #1603615 14/23714/2 mos-9.0
authorAlbert <asyriy@mirantis.com>
Wed, 27 Jul 2016 14:30:05 +0000 (17:30 +0300)
committerAlbert <asyriy@mirantis.com>
Wed, 27 Jul 2016 14:39:09 +0000 (17:39 +0300)
Change-Id: I74b1f1b88516c4e303e0ae63025967d7601625d9
Closes-Bug: #1603615

Mirantis-mangling-kopts-bugfix.patch [new file with mode: 0644]
cobbler.spec

diff --git a/Mirantis-mangling-kopts-bugfix.patch b/Mirantis-mangling-kopts-bugfix.patch
new file mode 100644 (file)
index 0000000..27b8c4d
--- /dev/null
@@ -0,0 +1,48 @@
+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
index 63676e301a8304e6cccb6f314618c18b3f053e65..dc573a154c11c26867fcde86f284664a0729ff81 100644 (file)
@@ -16,7 +16,7 @@ Name: cobbler
 License: GPLv2+
 AutoReq: no
 Version: 2.6.9
-Release: 1%{?dist}~mos10
+Release: 1%{?dist}~mos11
 Source0: https://github.com/cobbler/cobbler/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
 # Support newer virt-install - https://bugzilla.redhat.com/show_bug.cgi?id=1188424
 Patch0: cobbler-virtinstall.patch
@@ -28,6 +28,8 @@ Patch1: cobbler-centos.patch
 Patch2: cobbler-django17.patch
 # Add ALLOWED_HOSTS into djando settings
 Patch3: Mirantis-Add-ALLOWED_HOSTS-for-settings.patch
+# Bugfix for mangling kernel options with the key --in-place
+Patch4: Mirantis-mangling-kopts-bugfix.patch
 
 Group: Applications/System
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
@@ -93,6 +95,7 @@ other applications.
 %if 0%{?fedora} >= 22 || 0%{?rhel} >= 6
 %patch2 -p1 -b .django17
 %patch3 -p1
+%patch4 -p1
 %endif
 
 %build
@@ -288,6 +291,9 @@ sed -i -e "s/SECRET_KEY = ''/SECRET_KEY = \'$RAND_SECRET\'/" /usr/share/cobbler/
 
 
 %changelog
+* Wed Jul 27 2016 Albert Syriy <mos-linux-team@mirantis.com> - 2.6.9-1~mos11
+- Bug fix for mangling kernel options with the key --in-place LP#1603615
+
 * Thu May 19 2016 Ivan Suzdal <mos-linux-team@mirantis.com> - 2.6.9-1~mos10
 - Add patch to fix 'error 400' for cobbler-web (LP: #1583648)
 - Bump version