[PATCH 2/3] Restore support for partial kickstart files (#887254).

Chris Lumens clumens at redhat.com
Tue Feb 12 20:15:11 UTC 2013


---
 pyanaconda/kickstart.py                    |  4 ++--
 pyanaconda/packaging/yumpayload.py         |  6 ++++--
 pyanaconda/ui/gui/spokes/datetime_spoke.py | 22 ++++++++++++++--------
 pyanaconda/ui/gui/spokes/keyboard.py       |  9 ++++++---
 pyanaconda/ui/gui/spokes/software.py       | 20 ++++++++++----------
 pyanaconda/ui/gui/spokes/source.py         |  9 ++++++---
 pyanaconda/ui/gui/spokes/storage.py        | 24 +++++++++++++++++-------
 pyanaconda/ui/gui/spokes/welcome.py        |  6 ++++++
 pyanaconda/ui/tui/spokes/storage.py        |  5 ++++-
 9 files changed, 69 insertions(+), 36 deletions(-)

diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index f6bf222..2386944 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -577,9 +577,9 @@ class IscsiName(commands.iscsiname.FC6_IscsiName):
 class Lang(commands.lang.FC3_Lang):
     def __init__(self, *args, **kwargs):
         commands.lang.FC3_Lang.__init__(self, *args, **kwargs)
-        if not self.lang:
+        if not self.lang and not flags.automatedInstall:
             self.lang = DEFAULT_LANG
-    
+
     def execute(self, *args, **kwargs):
         localization.write_language_configuration(self, ROOT_PATH)
 
diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py
index 6ca2f3b..1f10176 100644
--- a/pyanaconda/packaging/yumpayload.py
+++ b/pyanaconda/packaging/yumpayload.py
@@ -415,10 +415,12 @@ reposdir=%s
         # start with a fresh YumBase instance
         self.reset(root=root)
 
-        # If askmethod was given on the command line, we don't want to do
+        # If this is a kickstart install and no method has been set up, or
+        # askmethod was given on the command line, we don't want to do
         # anything.  Just disable all repos and return.  This should avoid
         # metadata fetching.
-        if flags.askmethod:
+        if (not self.data.method.method and flags.automatedInstall) or \
+           flags.askmethod:
             with _yum_lock:
                 for repo in self._yum.repos.repos.values():
                     self.disableRepo(repo.id)
diff --git a/pyanaconda/ui/gui/spokes/datetime_spoke.py b/pyanaconda/ui/gui/spokes/datetime_spoke.py
index 6e5207f..fa913f9 100644
--- a/pyanaconda/ui/gui/spokes/datetime_spoke.py
+++ b/pyanaconda/ui/gui/spokes/datetime_spoke.py
@@ -366,17 +366,18 @@ class DatetimeSpoke(NormalSpoke):
         self._update_datetime_timer_id = None
         if timezone.is_valid_timezone(self.data.timezone.timezone):
             self._tzmap.set_timezone(self.data.timezone.timezone)
-        else:
+        elif not flags.flags.automatedInstall:
             log.warning("%s is not a valid timezone, falling back to default "\
                         "(%s)" % (self.data.timezone.timezone, DEFAULT_TZ))
             self._tzmap.set_timezone(DEFAULT_TZ)
             self.data.timezone.timezone = DEFAULT_TZ
 
-        if not flags.can_touch_runtime_system("modify system time and date"):
-            self._set_date_time_setting_sensitive(False)
+        if self.data.timezone.timezone:
+            if not flags.can_touch_runtime_system("modify system time and date"):
+                self._set_date_time_setting_sensitive(False)
 
-        self._config_dialog = NTPconfigDialog(self.data)
-        self._config_dialog.initialize()
+            self._config_dialog = NTPconfigDialog(self.data)
+            self._config_dialog.initialize()
 
     @property
     def status(self):
@@ -385,9 +386,10 @@ class DatetimeSpoke(NormalSpoke):
                 return _("%s timezone") % self.data.timezone.timezone
             else:
                 return _("Invalid timezone")
-
-        else:
+        elif self._tzmap.get_timezone():
             return _("%s timezone") % self._tzmap.get_timezone()
+        else:
+            return _("Nothing selected")
 
     def apply(self):
         GLib.source_remove(self._update_datetime_timer_id)
@@ -403,6 +405,7 @@ class DatetimeSpoke(NormalSpoke):
             new_tz = region + "/" + city
 
         self.data.timezone.timezone = new_tz
+        self.data.timezone.seen = True
 
         if self._ntpSwitch.get_active():
             # turned ON
@@ -430,7 +433,10 @@ class DatetimeSpoke(NormalSpoke):
 
     @property
     def completed(self):
-        return timezone.is_valid_timezone(self.data.timezone.timezone)
+        if flags.flags.automatedInstall and not self.data.timezone.seen:
+            return False
+        else:
+            return timezone.is_valid_timezone(self.data.timezone.timezone)
 
     @property
     def mandatory(self):
diff --git a/pyanaconda/ui/gui/spokes/keyboard.py b/pyanaconda/ui/gui/spokes/keyboard.py
index 082702c..c2a9de5 100644
--- a/pyanaconda/ui/gui/spokes/keyboard.py
+++ b/pyanaconda/ui/gui/spokes/keyboard.py
@@ -269,15 +269,18 @@ class KeyboardSpoke(NormalSpoke):
     def apply(self):
         # Clear and repopulate self.data with actual values
         self.data.keyboard.x_layouts = list()
+        self.data.keyboard.seen = True
+
         for row in self._store:
             self.data.keyboard.x_layouts.append(row[0])
         # FIXME:  Set the keyboard layout here, too.
 
     @property
     def completed(self):
-        # The keyboard spoke is always completed, as it does not require you do
-        # anything.  There's always a default selected.
-        return True
+        if flags.flags.automatedInstall and not self.data.keyboard.seen:
+            return False
+        else:
+            return True
 
     @property
     def status(self):
diff --git a/pyanaconda/ui/gui/spokes/software.py b/pyanaconda/ui/gui/spokes/software.py
index 3493d0c..cec0384 100644
--- a/pyanaconda/ui/gui/spokes/software.py
+++ b/pyanaconda/ui/gui/spokes/software.py
@@ -68,10 +68,7 @@ class SoftwareSelectionSpoke(NormalSpoke):
         self._origAddons = []
         self._origEnvironment = None
 
-    def apply(self):
-        # NOTE:  Other apply methods work directly with the ksdata, but this
-        # one does not.  However, selectGroup/deselectGroup modifies ksdata as
-        # part of its operation.  So this is fine.
+    def _apply(self):
         row = self._get_selected_environment()
         if not row:
             return
@@ -100,6 +97,10 @@ class SoftwareSelectionSpoke(NormalSpoke):
         threadMgr.add(AnacondaThread(name="AnaCheckSoftwareThread",
                                      target=self.checkSoftwareSelection))
 
+    def apply(self):
+        self._apply()
+        self.data.packages.seen = True
+
     def checkSoftwareSelection(self):
         from pyanaconda.packaging import DependencyError
         communication.send_message(self.__class__.__name__,
@@ -123,15 +124,15 @@ class SoftwareSelectionSpoke(NormalSpoke):
         processingDone = not threadMgr.get("AnaCheckSoftwareThread") and \
                          not self._errorMsgs and self.txid_valid
 
-        if flags.automatedInstall and self.data.packages.seen:
-            return processingDone
+        if flags.automatedInstall:
+            return processingDone and self.data.packages.seen
         else:
             return self._get_selected_environment() is not None and processingDone
 
     @property
     def mandatory(self):
         return True
-        
+
     @property
     def ready(self):
         # By default, the software selection spoke is not ready.  We have to
@@ -184,8 +185,7 @@ class SoftwareSelectionSpoke(NormalSpoke):
         # we have no way to select environments with kickstart right now
         # so don't try.
         if flags.automatedInstall and self.data.packages.seen:
-            # We don't want to do a full refresh, just
-            # join the metadata thread
+            # We don't want to do a full refresh, just join the metadata thread
             threadMgr.wait("AnaPayloadMDThread")
         else:
             if not self._first_refresh():
@@ -196,7 +196,7 @@ class SoftwareSelectionSpoke(NormalSpoke):
 
         # If packages were provided by an input kickstart file (or some other means),
         # we should do dependency solving here.
-        self.apply()
+        self._apply()
 
     @gtk_thread_wait
     def _first_refresh(self):
diff --git a/pyanaconda/ui/gui/spokes/source.py b/pyanaconda/ui/gui/spokes/source.py
index 5751ca0..43c4928 100644
--- a/pyanaconda/ui/gui/spokes/source.py
+++ b/pyanaconda/ui/gui/spokes/source.py
@@ -602,12 +602,15 @@ class SourceSpoke(NormalSpoke):
 
     @property
     def completed(self):
-        return not self._error and self.status and self.status != _("Nothing selected")
+        if flags.automatedInstall and not self.data.method.method:
+            return False
+        else:
+            return not self._error and self.status and self.status != _("Nothing selected")
 
     @property
     def mandatory(self):
         return True
-        
+
     @property
     def ready(self):
         from pyanaconda.threads import threadMgr
@@ -702,7 +705,7 @@ class SourceSpoke(NormalSpoke):
         if self.data.method.method == "cdrom":
             cdrom = self.payload.install_device
             chosen = True
-        else:
+        elif not flags.automatedInstall:
             cdrom = opticalInstallMedia(self.storage.devicetree)
 
         if cdrom:
diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py
index a3d31ff..0fc064f 100644
--- a/pyanaconda/ui/gui/spokes/storage.py
+++ b/pyanaconda/ui/gui/spokes/storage.py
@@ -436,12 +436,15 @@ class StorageSpoke(NormalSpoke, StorageChecker):
 
     @property
     def completed(self):
-        return (threadMgr.get("AnaExecuteStorageThread") is None and
-                threadMgr.get("AnaCheckStorageThread") is None and
-                (self.data.ignoredisk.onlyuse != [] or
-                 flags.automatedInstall) and
-                self.storage.rootDevice is not None and
-                not self.errors)
+        retval = (threadMgr.get("AnaExecuteStorageThread") is None and
+                  threadMgr.get("AnaCheckStorageThread") is None and
+                  self.storage.rootDevice is not None and
+                  not self.errors)
+
+        if flags.automatedInstall:
+            return retval and self.data.bootloader.seen
+        else:
+            return retval
 
     @property
     def ready(self):
@@ -457,7 +460,12 @@ class StorageSpoke(NormalSpoke, StorageChecker):
     def status(self):
         """ A short string describing the current status of storage setup. """
         msg = _("No disks selected")
-        if self.data.ignoredisk.onlyuse:
+
+        if flags.automatedInstall and not self.storage.rootDevice:
+            return msg
+        elif flags.automatedInstall and not self.data.bootloader.seen:
+            msg = _("No bootloader configured")
+        elif self.data.ignoredisk.onlyuse:
             msg = P_(("%d disk selected"),
                      ("%d disks selected"),
                      len(self.data.ignoredisk.onlyuse)) % len(self.data.ignoredisk.onlyuse)
@@ -643,6 +651,8 @@ class StorageSpoke(NormalSpoke, StorageChecker):
 
         self._update_summary()
 
+        self.data.bootloader.seen = True
+
         if self.data.bootloader.location == "none":
             self.set_warning(_("You have chosen to skip bootloader installation.  Your system may not be bootable."))
             self.window.show_all()
diff --git a/pyanaconda/ui/gui/spokes/welcome.py b/pyanaconda/ui/gui/spokes/welcome.py
index 80bf7ac..d4f8e15 100644
--- a/pyanaconda/ui/gui/spokes/welcome.py
+++ b/pyanaconda/ui/gui/spokes/welcome.py
@@ -60,6 +60,12 @@ class LanguageMixIn(object):
         self.language.select_translation(lang)
         self.data.lang.lang = lang
 
+        # Skip timezone and keyboard default setting for kickstart installs.
+        # The user may have provided these values via kickstart and if not, we
+        # need to prompt for them.
+        if flags.flags.automatedInstall:
+            return
+
         #TODO: better use GeoIP data once it is available
         if self.language.territory and not self.data.timezone.timezone:
             lang_timezone = timezone.get_preferred_timezone(self.language.territory)
diff --git a/pyanaconda/ui/tui/spokes/storage.py b/pyanaconda/ui/tui/spokes/storage.py
index 80e3094..58428fc 100644
--- a/pyanaconda/ui/tui/spokes/storage.py
+++ b/pyanaconda/ui/tui/spokes/storage.py
@@ -127,7 +127,10 @@ class StorageSpoke(NormalTUISpoke):
     def status(self):
         """ A short string describing the current status of storage setup. """
         msg = _("No disks selected")
-        if self.data.ignoredisk.onlyuse:
+
+        if flags.automatedInstall and not self.storage.rootDevice:
+            return msg
+        elif self.data.ignoredisk.onlyuse:
             msg = P_(("%d disk selected"),
                      ("%d disks selected"),
                      len(self.data.ignoredisk.onlyuse)) % len(self.data.ignoredisk.onlyuse)
-- 
1.7.11.2



More information about the anaconda-patches mailing list