[rhel7-branch][master][PATCH] Handle kickstarts that don't specify timezone (#1001598)

Martin Kolman mkolman at redhat.com
Thu Sep 5 13:10:21 UTC 2013


During kickstarted installation, no default timezone is set
and if the kickstart does not specify a timezone, the date time spoke
needs to work correctly without an initial timezone value.

Signed-off-by: Martin Kolman <mkolman at redhat.com>
---
 pyanaconda/ui/gui/spokes/datetime_spoke.py | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/datetime_spoke.py b/pyanaconda/ui/gui/spokes/datetime_spoke.py
index 5e0c9ce..cfd4887 100644
--- a/pyanaconda/ui/gui/spokes/datetime_spoke.py
+++ b/pyanaconda/ui/gui/spokes/datetime_spoke.py
@@ -405,12 +405,16 @@ class DatetimeSpoke(FirstbootSpokeMixIn, NormalSpoke):
             return _("Nothing selected")
 
     def apply(self):
-        old_tz = self.data.timezone.timezone
-
         # we could use self._tzmap.get_timezone() here, but it returns "" if
         # Etc/XXXXXX timezone is selected
         region = self._get_active_region()
         city = self._get_active_city()
+        # nothing selected, just leave the spoke and
+        # return to hub without changing anything
+        if not region or not city:
+            return
+
+        old_tz = self.data.timezone.timezone
         new_tz = region + "/" + city
 
         self.data.timezone.timezone = new_tz
@@ -702,8 +706,9 @@ class DatetimeSpoke(FirstbootSpokeMixIn, NormalSpoke):
 
     def _restore_old_city_region(self):
         """Restore stored "old" (or last valid) values."""
-
-        self._set_timezone(self._old_region + "/" + self._old_city)
+        # check if there are old value to go back to
+        if self._old_region and self._old_city:
+            self._set_timezone(self._old_region + "/" + self._old_city)
 
     def on_up_hours_clicked(self, *args):
         self._stop_and_maybe_start_time_updating()
-- 
1.8.3.1



More information about the anaconda-patches mailing list