diff --git a/pyanaconda/modules/timezone/installation.py b/pyanaconda/modules/timezone/installation.py index d6dfd7bf721c..fcd04d175082 100644 --- a/pyanaconda/modules/timezone/installation.py +++ b/pyanaconda/modules/timezone/installation.py @@ -24,7 +24,7 @@ from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.modules.common.errors.installation import TimezoneConfigurationError from pyanaconda.modules.common.task import Task -from pyanaconda.timezone import is_valid_timezone +from pyanaconda.timezone import is_valid_timezone, is_valid_ui_timezone from blivet import arch @@ -60,7 +60,11 @@ def run(self): def _correct_timezone(self): """Ensure the timezone is valid.""" - if not is_valid_timezone(self._timezone): + if is_valid_timezone(self._timezone): + if not is_valid_ui_timezone(self._timezone): + log.warning("Timezone specification %s set in kickstart is " + "not offered by installer GUI.", self._timezone) + else: # this should never happen, but for pity's sake log.warning("Timezone %s set in kickstart is not valid, " "falling back to default (America/New_York).", self._timezone) diff --git a/pyanaconda/timezone.py b/pyanaconda/timezone.py index e9aa826b1432..72374a033595 100644 --- a/pyanaconda/timezone.py +++ b/pyanaconda/timezone.py @@ -148,9 +148,9 @@ def get_all_regions_and_timezones(): return result -def is_valid_timezone(timezone): +def is_valid_ui_timezone(timezone): """ - Check if a given string is an existing timezone. + Check if a given string is a timezone specification offered by GUI. :type timezone: str :rtype: bool @@ -162,6 +162,23 @@ def is_valid_timezone(timezone): return timezone in pytz.common_timezones + etc_zones +def is_valid_timezone(timezone): + """ + Check if a given string is a valid timezone specification. + + This includes also deprecated/backward timezones linked to other timezones + in tz database (eg Japan -> Asia/Tokyo). Both the tzdata package (installed + system) and TimezoneMap widget (installer GUI) should support them and be + able link them to the correct timezone specification using the data from + "backward" file. + + :type timezone: str + :rtype: bool + """ + + return is_valid_ui_timezone(timezone) or timezone in pytz.all_timezones + + def get_timezone(timezone): """ Return a tzinfo object for a given timezone name. diff --git a/pyanaconda/ui/gui/spokes/datetime_spoke.py b/pyanaconda/ui/gui/spokes/datetime_spoke.py index c99f451f85fb..117dfe3a9a3f 100644 --- a/pyanaconda/ui/gui/spokes/datetime_spoke.py +++ b/pyanaconda/ui/gui/spokes/datetime_spoke.py @@ -48,7 +48,8 @@ from pyanaconda.ui.gui.utils import blockedHandler from pyanaconda.ui.gui.helpers import GUIDialogInputCheckHandler from pyanaconda.ui.helpers import InputCheck -from pyanaconda.timezone import NTP_SERVICE, get_all_regions_and_timezones, get_timezone, is_valid_timezone +from pyanaconda.timezone import NTP_SERVICE, get_all_regions_and_timezones, get_timezone, \ + is_valid_timezone, is_valid_ui_timezone from pyanaconda.threading import threadMgr, AnacondaThread import gi @@ -532,8 +533,13 @@ def _initialize(self): self._update_datetime_timer = None kickstart_timezone = self._timezone_module.Timezone - if is_valid_timezone(kickstart_timezone): + if is_valid_ui_timezone(kickstart_timezone): self._set_timezone(kickstart_timezone) + elif is_valid_timezone(kickstart_timezone): + log.warning("Timezone specification %s is not offered by installer GUI.", + kickstart_timezone) + # Try to get the correct linked timezone via TimezoneMap selection + self._tzmap.set_timezone(kickstart_timezone) time_init_thread = threadMgr.get(constants.THREAD_TIME_INIT) if time_init_thread is not None: