[PATCH 3/3] Handle automated installs

Jesse Keating jkeating at redhat.com
Tue Sep 18 20:08:55 UTC 2012


This follows the same design as GUI.  If the install is automated, and
all the spokes are complete, proceed into the installation phase.
However if there are incomplete spokes, let the user finish those
spokes.  As soon as all spokes are complete jump straight to the install
phase.

Note that any new spoke that has a background process that could make it
not be "ready" immediately is going to have to be accounted for here,
which is ugly.  Perhaps a object attribute that is a list of potential
threads to join would work?
---
 pyanaconda/ui/tui/hubs/summary.py | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/pyanaconda/ui/tui/hubs/summary.py b/pyanaconda/ui/tui/hubs/summary.py
index 8c2f4cc..47cc73d 100644
--- a/pyanaconda/ui/tui/hubs/summary.py
+++ b/pyanaconda/ui/tui/hubs/summary.py
@@ -20,6 +20,7 @@
 #
 
 from pyanaconda.ui.tui.hubs import TUIHub
+from pyanaconda.flags import flags
 
 import gettext
 _ = lambda x: gettext.ldgettext("anaconda", x)
@@ -27,3 +28,33 @@ _ = lambda x: gettext.ldgettext("anaconda", x)
 class SummaryHub(TUIHub):
     title = _("Install hub")
     categories = ["source", "localization", "destination", "password"]
+
+    def __init__(self, app, data, storage, payload, instclass):
+        TUIHub.__init__(self, app, data, storage, payload, instclass)
+        if flags.automatedInstall:
+            print(_("Starting automated install"))
+            # Join the initialization thread to block on it
+            from pyanaconda.threads import threadMgr
+
+            # This assumes that the storage thread is the only
+            # one that can be "unready".  This puts knowledge here
+            # that really shouldn't be here.
+            initThread = threadMgr.get("AnaStorageWatcher")
+            if initThread:
+                print(_("Probing storage..."))
+                initThread.join()
+
+            for spoke in self._keys.values():
+                if spoke.ready:
+                    spoke.execute()
+
+    # override the prompt so that we can skip user input on kickstarts
+    # where all the data is in hand.  If not in hand, do the actual prompt.
+    def prompt(self, args=None):
+        if flags.automatedInstall:
+            for spoke in self._keys.values():
+                if not spoke.completed:
+                    return TUIHub.prompt(self, args)
+            self.close()
+            return None
+        return TUIHub.prompt(self, args)
\ No newline at end of file
-- 
1.7.11.4



More information about the anaconda-patches mailing list