[PATCH 4/4] Handle automated installs

Jesse Keating jkeating at redhat.com
Wed Sep 19 23:54:06 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 | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/pyanaconda/ui/tui/hubs/summary.py b/pyanaconda/ui/tui/hubs/summary.py
index 8c2f4cc..7a74eca 100644
--- a/pyanaconda/ui/tui/hubs/summary.py
+++ b/pyanaconda/ui/tui/hubs/summary.py
@@ -17,9 +17,13 @@
 # Red Hat, Inc.
 #
 # Red Hat Author(s): Martin Sivak <msivak at redhat.com>
+#                    Jesse Keating <jkeating at redhat.com>
 #
 
 from pyanaconda.ui.tui.hubs import TUIHub
+from pyanaconda.flags import flags
+import sys
+import time
 
 import gettext
 _ = lambda x: gettext.ldgettext("anaconda", x)
@@ -27,3 +31,29 @@ _ = 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:
+            sys.stdout.write(_("Starting automated install"))
+            sys.stdout.flush()
+            spokes = self._keys.values()
+            while True:
+                if all(spoke.ready for spoke in spokes):
+                    print('')
+                    break
+                sys.stdout.write('.')
+                sys.stdout.flush()
+                time.sleep(1)
+
+            for spoke in spokes:
+                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 and \
+        all(spoke.completed for spoke in self._keys.values()):
+            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