[PATCH] Just preserve the %addon header args if an addon is missing (#1155955)
Martin Kolman
mkolman at redhat.com
Fri Nov 21 16:17:23 UTC 2014
From: Vratislav Podzimek <vpodzime at redhat.com>
We should handle missing addons gracefully by simply ignoring and preserving the
their %addon kickstart sections not raise an exception.
(cherry picked from commit f62eff42b6a5b6cfe191408cd9d70f1452f1af43)
Resolves: rhbz#1155955
Signed-off-by: Martin Kolman <mkolman at redhat.com>
---
pyanaconda/addons.py | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/pyanaconda/addons.py b/pyanaconda/addons.py
index a7e1448..a7b6c07 100644
--- a/pyanaconda/addons.py
+++ b/pyanaconda/addons.py
@@ -111,9 +111,10 @@ class AddonData(object):
def __init__(self, name):
self.name = name
self.content = ""
+ self.header_args = ""
def __str__(self):
- return "%%addon %s\n%s%%end\n" % (self.name, self.content)
+ return "%%addon %s %s\n%s%%end\n" % (self.name, self.header_args, self.content)
# pylint: disable=C0103
def setup(self, storage, ksdata, instClass):
@@ -142,16 +143,13 @@ class AddonData(object):
This function would be called with args=["--argument='example'"].
- By default AddonData.handle_header will fail if passed any arguments,
- so addon sections that take arguments must override this method.
+ By default AddonData.handle_header just preserves the passed
+ arguments by storing them and adding them to the __str__ output.
+
"""
if args:
- msg = _("Unhandled arguments on %%addon line for %s") % self.name
- if lineno != None:
- raise KickstartParseError(formatErrorMsg(lineno, msg=msg))
- else:
- raise KickstartParseError(msg)
+ self.header_args += " ".join(args)
def handle_line(self, line):
"""Process one kickstart line."""
--
1.9.3
More information about the anaconda-patches
mailing list