From 0fad2179c0b760157abcf2ae5ceca7c8f396fadd Mon Sep 17 00:00:00 2001 From: Hongxu Jia Date: Sat, 29 Jun 2019 12:13:28 +0800 Subject: [PATCH] disable ntp support The upstream RHEL7 use chrony.service to support ntp, it did not exist in oe-core, so remove it. Do not support NTP, here are the reasons: - For systemd based, it already had NTP supported, another ntp will cause confliction. - We also need to consider the situation of sysvinit based system, it requires a ntp package to be installed. Upstream-Status: Inappropriate [oe specific] Signed-off-by: Hongxu Jia --- pyanaconda/kickstart.py | 54 +--------------- pyanaconda/ui/gui/spokes/datetime_spoke.glade | 74 ---------------------- pyanaconda/ui/gui/spokes/datetime_spoke.py | 89 --------------------------- 3 files changed, 1 insertion(+), 216 deletions(-) diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py index 88d552d..5b69ebb 100644 --- a/pyanaconda/kickstart.py +++ b/pyanaconda/kickstart.py @@ -760,35 +760,7 @@ class Timezone(RemovedCommand): return timezone_proxy.GenerateKickstart() def setup(self, ksdata): - timezone_proxy = TIMEZONE.get_proxy() - services_proxy = SERVICES.get_proxy() - - enabled_services = services_proxy.EnabledServices - disabled_services = services_proxy.DisabledServices - - # do not install and use NTP package - if not timezone_proxy.NTPEnabled or NTP_PACKAGE in ksdata.packages.excludedList: - if util.service_running(NTP_SERVICE) and conf.system.can_set_time_synchronization: - ret = util.stop_service(NTP_SERVICE) - if ret != 0: - timezone_log.error("Failed to stop NTP service") - - if NTP_SERVICE not in disabled_services: - disabled_services.append(NTP_SERVICE) - services_proxy.SetDisabledServices(disabled_services) - # install and use NTP package - else: - if not util.service_running(NTP_SERVICE) and conf.system.can_set_time_synchronization: - ret = util.start_service(NTP_SERVICE) - if ret != 0: - timezone_log.error("Failed to start NTP service") - - self.packages.append(NTP_PACKAGE) - - if not NTP_SERVICE in enabled_services and \ - not NTP_SERVICE in disabled_services: - enabled_services.append(NTP_SERVICE) - services_proxy.SetEnabledServices(enabled_services) + pass def execute(self): # get the DBus proxies @@ -805,30 +777,6 @@ class Timezone(RemovedCommand): timezone.write_timezone_config(timezone_proxy, util.getSysroot()) - # write out NTP configuration (if set) and --nontp is not used - kickstart_ntp_servers = timezone_proxy.NTPServers - - if timezone_proxy.NTPEnabled and kickstart_ntp_servers: - chronyd_conf_path = os.path.normpath(util.getSysroot() + ntp.NTP_CONFIG_FILE) - pools, servers = ntp.internal_to_pools_and_servers(kickstart_ntp_servers) - if os.path.exists(chronyd_conf_path): - timezone_log.debug("Modifying installed chrony configuration") - try: - ntp.save_servers_to_config(pools, servers, conf_file_path=chronyd_conf_path) - except ntp.NTPconfigError as ntperr: - timezone_log.warning("Failed to save NTP configuration: %s", ntperr) - # use chrony conf file from installation environment when - # chrony is not installed (chrony conf file is missing) - else: - timezone_log.debug("Creating chrony configuration based on the " - "configuration from installation environment") - try: - ntp.save_servers_to_config(pools, servers, - conf_file_path=ntp.NTP_CONFIG_FILE, - out_file_path=chronyd_conf_path) - except ntp.NTPconfigError as ntperr: - timezone_log.warning("Failed to save NTP configuration without chrony package: %s", ntperr) - class User(COMMANDS.User): def execute(self, storage, ksdata, users): diff --git a/pyanaconda/ui/gui/spokes/datetime_spoke.glade b/pyanaconda/ui/gui/spokes/datetime_spoke.glade index 37c7c6e..875cfea 100644 --- a/pyanaconda/ui/gui/spokes/datetime_spoke.glade +++ b/pyanaconda/ui/gui/spokes/datetime_spoke.glade @@ -460,80 +460,6 @@ 3 - - - True - False - 1 - 0.20000000298023224 - 24 - - - True - False - end - - - True - False - _Network Time - True - networkTimeSwitch - - - False - True - 3 - 0 - - - - - True - True - - - - Use Network Time - - - - - False - True - 1 - 1 - - - - - True - True - True - configImage - - - - Configure NTP - - - - - False - True - 1 - 2 - - - - - - - True - True - 4 - - diff --git a/pyanaconda/ui/gui/spokes/datetime_spoke.py b/pyanaconda/ui/gui/spokes/datetime_spoke.py index 9ce853d..a83c2c9 100644 --- a/pyanaconda/ui/gui/spokes/datetime_spoke.py +++ b/pyanaconda/ui/gui/spokes/datetime_spoke.py @@ -500,8 +500,6 @@ class DatetimeSpoke(FirstbootSpokeMixIn, NormalSpoke): self._year_format, suffix = formats[widgets.index(year_box)] year_label.set_text(suffix) - self._ntpSwitch = self.builder.get_object("networkTimeSwitch") - self._regions_zones = get_all_regions_and_timezones() # Set the initial sensitivity of the AM/PM toggle based on the time-type selected @@ -510,9 +508,6 @@ class DatetimeSpoke(FirstbootSpokeMixIn, NormalSpoke): if not conf.system.can_set_system_clock: self._hide_date_time_setting() - self._config_dialog = NTPconfigDialog(self.data, self._timezone_module) - self._config_dialog.initialize() - threadMgr.add(AnacondaThread(name=constants.THREAD_DATE_TIME, target=self._initialize)) @@ -600,8 +595,6 @@ class DatetimeSpoke(FirstbootSpokeMixIn, NormalSpoke): # TODO: seen should be set from the module self._kickstarted = False - self._timezone_module.proxy.SetNTPEnabled(self._ntpSwitch.get_active()) - def execute(self): if self._update_datetime_timer is not None: self._update_datetime_timer.cancel() @@ -639,20 +632,6 @@ class DatetimeSpoke(FirstbootSpokeMixIn, NormalSpoke): self._update_datetime() - has_active_network = self._network_module.proxy.Connected - if not has_active_network: - self._show_no_network_warning() - else: - self.clear_info() - gtk_call_once(self._config_dialog.refresh_servers_state) - - if conf.system.can_set_time_synchronization: - ntp_working = has_active_network and util.service_running(NTP_SERVICE) - else: - ntp_working = self._timezone_module.proxy.NTPEnabled - - self._ntpSwitch.set_active(ntp_working) - @async_action_wait def _set_timezone(self, timezone): """ @@ -1111,71 +1090,3 @@ class DatetimeSpoke(FirstbootSpokeMixIn, NormalSpoke): #contains all date/time setting widgets footer_alignment = self.builder.get_object("footerAlignment") footer_alignment.set_sensitive(sensitive) - - def _show_no_network_warning(self): - self.set_warning(_("You need to set up networking first if you "\ - "want to use NTP")) - - def _show_no_ntp_server_warning(self): - self.set_warning(_("You have no working NTP server configured")) - - def on_ntp_switched(self, switch, *args): - if switch.get_active(): - #turned ON - if not conf.system.can_set_time_synchronization: - #cannot touch runtime system, not much to do here - return - - if not self._network_module.proxy.Connected: - self._show_no_network_warning() - switch.set_active(False) - return - else: - self.clear_info() - - working_server = self._config_dialog.working_server - if working_server is None: - self._show_no_ntp_server_warning() - else: - #we need a one-time sync here, because chronyd would not change - #the time as drastically as we need - ntp.one_time_sync_async(working_server) - - ret = util.start_service(NTP_SERVICE) - self._set_date_time_setting_sensitive(False) - - #if starting chronyd failed and chronyd is not running, - #set switch back to OFF - if (ret != 0) and not util.service_running(NTP_SERVICE): - switch.set_active(False) - - else: - #turned OFF - if not conf.system.can_set_time_synchronization: - #cannot touch runtime system, nothing to do here - return - - self._set_date_time_setting_sensitive(True) - ret = util.stop_service(NTP_SERVICE) - - #if stopping chronyd failed and chronyd is running, - #set switch back to ON - if (ret != 0) and util.service_running(NTP_SERVICE): - switch.set_active(True) - - self.clear_info() - - def on_ntp_config_clicked(self, *args): - self._config_dialog.refresh() - - with self.main_window.enlightbox(self._config_dialog.window): - response = self._config_dialog.run() - - if response == 1: - pools, servers = self._config_dialog.pools_servers - self._timezone_module.proxy.SetNTPServers(ntp.pools_servers_to_internal(pools, servers)) - - if self._config_dialog.working_server is None: - self._show_no_ntp_server_warning() - else: - self.clear_info() -- 2.7.4