Re: [PATCH 1/2] Fix traceback in timezone setting (kickstart interactive text mode) (#481617)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This looks good to me. And I now realize the other timezone patch I reviewed is not for rawhide, but for RHEL-5. At any rate, I like the other patch for RHEL-5.

I'd like to propose a system for noting branches when we send patches to the list for review. I'll send a new message to the list so it's not buried here.

Radek Vykydal wrote:
This is less intrusive (regarding existing kickstart configurations) fix of
bug 404321 - traceback in interactive text mode happening when timezone set in
kickstart is not valid (i.e. not present in zonetab module).  Unlike previous
approach, it doesn't ask user to select valid timezone (breaking unattednded ks
install), but fails to set systemtime for install (if respective zoneinfo file is
not present in stage 2) or configure timezone (if respective zoneinfo file is not
present in tzdata package) only with messages in log files (as it used to be).

Next step is to make valid timezones available for setting of install
environment system time (i.e. present in stage 2).
---
 kickstart.py           |   10 ++++++----
 textw/timezone_text.py |    4 +++-
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/kickstart.py b/kickstart.py
index d1631ec..8220806 100644
--- a/kickstart.py
+++ b/kickstart.py
@@ -27,6 +27,7 @@ import partRequests
 import urlgrabber.grabber as grabber
 import lvm
 import warnings
+import zonetab
 from pykickstart.constants import *
 from pykickstart.parser import *
 from pykickstart.data import *
@@ -632,10 +633,11 @@ class AnacondaKSHandlers(KickstartHandlers):
     def doTimezone(self, args):
         KickstartHandlers.doTimezone(self, args)
         dict = self.ksdata.timezone
-        tzfile = "/usr/share/zoneinfo/" + dict["timezone"]
-        if not os.access(tzfile, os.R_OK):
-            log.warning("Can't read timezone file set in kickstart, will ask")
-            return
+        # check validity
+        tab = zonetab.ZoneTab()
+        if dict["timezone"] not in (entry.tz.replace(' ','_') for entry in
+                                 tab.getEntries()):
+            log.warning("Timezone %s set in kickstart is not valid." % (dict["timezone"],))
self.id.instClass.setTimezoneInfo(self.id, dict["timezone"], dict["isUtc"])
 	self.skipSteps.append("timezone")
diff --git a/textw/timezone_text.py b/textw/timezone_text.py
index 431836f..f30e68f 100644
--- a/textw/timezone_text.py
+++ b/textw/timezone_text.py
@@ -80,7 +80,9 @@ class TimezoneWindow:
         for tz in timezones:
 	    self.l.append(_(tz), tz)
- self.l.setCurrent(default)
+        # snack raises KeyError if the item doesn't exist in list
+        if default in (tz.replace(' ', '_') for tz in timezones):
+	    self.l.setCurrent(default)
 #	self.l.setCallback(self.updateClock)
self.c = Checkbox(_("System clock uses UTC"), isOn = asUtc)


--
David Cantrell <dcantrell@xxxxxxxxxx>
Red Hat / Honolulu, HI

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux