From 17c2693c74e39bac932798398033c2bb815aee7c Mon Sep 17 00:00:00 2001 From: David Cantrell Date: Tue, 22 May 2018 15:40:43 -0400 Subject: [PATCH] Include the _sortCommand to the _setCommand method (vponcova, #1578930) --- pykickstart-rhbz1578930.patch | 56 +++++++++++++++++++++++++++++++++++ pykickstart.spec | 7 ++++- 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 pykickstart-rhbz1578930.patch diff --git a/pykickstart-rhbz1578930.patch b/pykickstart-rhbz1578930.patch new file mode 100644 index 0000000..7ac5242 --- /dev/null +++ b/pykickstart-rhbz1578930.patch @@ -0,0 +1,56 @@ +commit f618b966fe3358b89412e58b9b249edb35b154dc +Author: Vendula Poncova +Date: Thu May 17 20:38:22 2018 +0200 + + Include the _sortCommand to the _setCommand method (#1578930) + + The _sortCommand method should be part of the _setCommand method, + otherwise we might set the command without changing the _writeOrder + dictionary. + + This should fix the resetCommand method, where the dictionary wasn't + updated, so the old instance of the command was used to generate the + kickstart representation. + + Resolves: rhbz#1578930 + +diff --git a/pykickstart/base.py b/pykickstart/base.py +index 00b5c8f..f695dcc 100644 +--- a/pykickstart/base.py ++++ b/pykickstart/base.py +@@ -306,7 +306,6 @@ class KickstartHandler(KickstartObject): + + setattr(self, name.lower(), cmdObj) + +- def _sortCommand(self, cmdObj): + # Also, add the object into the _writeOrder dict in the right place. + if cmdObj.writePriority is not None: + if cmdObj.writePriority in self._writeOrder: +@@ -332,7 +331,6 @@ class KickstartHandler(KickstartObject): + if cmdObj is None: + cmdObj = cmdClass() + self._setCommand(cmdObj) +- self._sortCommand(cmdObj) + + # Finally, add the mapping to the commands dict. + self.commands[cmdName] = cmdObj +diff --git a/tests/base.py b/tests/base.py +index 2d3961c..e1f4689 100644 +--- a/tests/base.py ++++ b/tests/base.py +@@ -232,6 +232,7 @@ class HandlerResetCommand_TestCase(ParserTest): + self.assertTrue(self.handler.autopart.encrypted) + self.assertEqual(self.handler.autopart.passphrase, "something") + self.assertTrue(self.handler.autopart.bogus) ++ self.assertTrue("autopart" in str(self.handler)) + + self.handler.resetCommand("autopart") + self.assertFalse(self.handler.autopart.autopart) +@@ -239,6 +240,7 @@ class HandlerResetCommand_TestCase(ParserTest): + self.assertFalse(self.handler.autopart.encrypted) + self.assertEqual(self.handler.autopart.passphrase, "") + self.assertNotIn("bogus", self.handler.autopart.__dict__) ++ self.assertFalse("autopart" in str(self.handler)) + + class HandlerDispatch_TestCase(ParserTest): + def runTest(self): diff --git a/pykickstart.spec b/pykickstart.spec index 57d0fbe..75d9a89 100644 --- a/pykickstart.spec +++ b/pykickstart.spec @@ -11,7 +11,7 @@ Name: pykickstart Version: 3.14 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2 and MIT Group: System Environment/Libraries Summary: Python utilities for manipulating kickstart files. @@ -20,6 +20,7 @@ Url: http://fedoraproject.org/wiki/pykickstart # our distribution. Thus the source is only available from # within this srpm. Source0: %{name}-%{version}.tar.gz +Patch0: pykickstart-rhbz1578930.patch BuildArch: noarch @@ -77,6 +78,7 @@ the pykickstart package. %prep %setup -q +%patch0 -p1 %if %{with python2} rm -rf %{py3dir} @@ -142,6 +144,9 @@ make PYTHON=%{__python3} test %{python3_sitelib}/pykickstart*.egg-info %changelog +* Tue May 22 2018 David Cantrell - 3.14-2 +- Include the _sortCommand to the _setCommand method (vponcova, #1578930) + * Mon May 14 2018 David Cantrell - 3.14-1 - Increment version to 3.14 (dcantrell) - Commit the new version in make bumpver. (dcantrell)