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@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."""
On Tue, 2014-10-21 at 11:43 +0200, Vratislav Podzimek wrote:
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@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."""
Looks good to me, thanks & ACK! :)
anaconda-patches@lists.fedorahosted.org