diff options
-rw-r--r-- | pyanaconda/addons.py | 42 | ||||
-rw-r--r-- | pyanaconda/install.py | 5 | ||||
-rw-r--r-- | pyanaconda/ui/gui/__init__.py | 2 |
3 files changed, 37 insertions, 12 deletions
diff --git a/pyanaconda/addons.py b/pyanaconda/addons.py index 0aa0fd359..4d817489b 100644 --- a/pyanaconda/addons.py +++ b/pyanaconda/addons.py @@ -39,7 +39,7 @@ def collect_addon_paths(toplevel_addon_paths, ui_subdir="gui"): "ks": [], "categories": [] } - + for path in toplevel_addon_paths: try: directories = os.listdir(path) @@ -68,7 +68,7 @@ class AddonRegistry(object): It acts as a proxy during kickstart save. """ - + def __init__(self, dictionary): self.__dict__ = dictionary @@ -76,11 +76,20 @@ class AddonRegistry(object): return reduce(lambda acc,(id, addon): acc + "%%addon %s\n%s%%end\n" % (id, str(addon)), self.__dict__.iteritems(), "") - def execute(self, storage, ksdata, instClass): + # pylint: disable-msg=C0103 + def execute(self, storage, ksdata, instClass, users): """This method calls execute on all the registered addons.""" for k, v in self.__dict__.iteritems(): - v.execute(storage, ksdata, instClass) - + if hasattr(v, "execute"): + v.execute(storage, ksdata, instClass, users) + + def setup(self, storage, ksdata, instClass): + """This method calls setup on all the registered addons.""" + for k, v in self.__dict__.iteritems(): + if hasattr(v, "setup"): + v.setup(storage, ksdata, instClass) + + class AddonData(object): """This is a common parent class for loading and storing 3rd party data to kickstart. It is instantiated by @@ -96,7 +105,7 @@ class AddonData(object): There is also a mandatory method execute, which should make all the described changes to the installed system. """ - + def __init__(self, name): self.name = name self.content = "" @@ -104,8 +113,21 @@ class AddonData(object): def __str__(self): return self.content - def execute(self, storage, ksdata, instClass): - """Make the changes to the underlying system.""" + # pylint: disable-msg=C0103 + def setup(self, storage, ksdata, instClass): + """Make the changes to the install system. + + This method is called before the installation + is started and directly from spokes. It must be possible + to call it multiple times without breaking the environment.""" + pass + + def execute(self, storage, ksdata, instClass, users): + """Make the changes to the underlying system. + + This method is called only once in the post-install + setup phase. + """ pass def handle_line(self, line): @@ -133,10 +155,10 @@ class AddonSection(Section): """Process the arguments to the %addon header.""" Section.handleHeader(self, lineno, args) op = KSOptionParser(version=self.version) - (opts, extra) = op.parse_args(args=args[1:], lineno=lineno) + (_opts, extra) = op.parse_args(args=args[1:], lineno=lineno) self.addon_id = extra[0] # if the addon is not registered, create dummy placeholder for it if self.addon_id and not hasattr(self.handler.addon, self.addon_id): - setattr(self.handler.addon, self.addon_id, AnacondaKSAddon(self.addon_id)) + setattr(self.handler.addon, self.addon_id, AddonData(self.addon_id)) diff --git a/pyanaconda/install.py b/pyanaconda/install.py index 4f8164649..1cccd9f2a 100644 --- a/pyanaconda/install.py +++ b/pyanaconda/install.py @@ -109,9 +109,12 @@ def doInstall(storage, payload, ksdata, instClass): steps = len(storage.devicetree.findActions(type="create", object="format")) + \ len(storage.devicetree.findActions(type="resize", object="format")) + \ len(storage.devicetree.findActions(type="migrate", object="format")) - steps += 4 # packages setup, packages, bootloader, post install + steps += 5 # pre setup phase, packages setup, packages, bootloader, post install progress.send_init(steps) + with progress_report(_("Setting up the install environment")): + ksdata.addon.setup(storage, ksdata, instClass) + # Do partitioning. payload.preStorage() turnOnFilesystems(storage) diff --git a/pyanaconda/ui/gui/__init__.py b/pyanaconda/ui/gui/__init__.py index a31b0ed6c..aec6db929 100644 --- a/pyanaconda/ui/gui/__init__.py +++ b/pyanaconda/ui/gui/__init__.py @@ -18,7 +18,7 @@ # # Red Hat Author(s): Chris Lumens <clumens@redhat.com> # -import importlib, inspect, os, sys, time +import inspect, os, sys, time import meh.ui.gui from gi.repository import Gdk |