[anaconda:all][PATCH] Just preserve the %addon header args if an addon is missing (#1155026)
Vratislav Podzimek
vpodzime at redhat.com
Tue Oct 21 09:43:45 UTC 2014
We should handle missing addons gracefully by simply ignoring and preserving the
their %addon kickstart sections not raise an exception.
Signed-off-by: Vratislav Podzimek <vpodzime 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 c95f41a..75a9109 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)
def setup(self, storage, ksdata, instClass):
"""Make the changes to the install system.
@@ -141,16 +142,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