def initialize(self): self.initialize_start() # We get the initial NTP servers (if any): # - from kickstart when running inside of Anaconda # during the installation # - from config files when running in Initial Setup # after the installation if constants.ANACONDA_ENVIRON in flags.environs: self._ntp_servers = TimeSourceData.from_structure_list( self._timezone_module.TimeSources) elif constants.FIRSTBOOT_ENVIRON in flags.environs: self._ntp_servers = ntp.get_servers_from_config() else: log.error( "tui time spoke: unsupported environment configuration %s," "can't decide where to get initial NTP servers", flags.environs) # check if the newly added NTP servers work fine for server in self._ntp_servers: self._ntp_servers_states.check_status(server) # we assume that the NTP spoke is initialized enough even if some NTP # server check threads might still be running self.initialize_done()
def initialize(self): self.initialize_start() # We get the initial NTP servers (if any): # - from kickstart when running inside of Anaconda # during the installation # - from config files when running in Initial Setup # after the installation ntp_servers = [] if constants.ANACONDA_ENVIRON in flags.environs: ntp_servers = self.data.timezone.ntpservers elif constants.FIRSTBOOT_ENVIRON in flags.environs: ntp_servers = ntp.get_servers_from_config()[ 1] # returns a (NPT pools, NTP servers) tupple else: log.error( "tui time spoke: unsupported environment configuration %s," "can't decide where to get initial NTP servers", flags.environs) # check if the NTP servers appear to be working or not if ntp_servers: for server in ntp_servers: self._ntp_servers[server] = constants.NTP_SERVER_QUERY # check if the newly added NTP servers work fine self._check_ntp_servers_async(self._ntp_servers.keys()) # we assume that the NTP spoke is initialized enough even if some NTP # server check threads might still be running self.initialize_done()
def initialize(self): self.initialize_start() # We get the initial NTP servers (if any): # - from kickstart when running inside of Anaconda # during the installation # - from config files when running in Initial Setup # after the installation ntp_servers = [] if constants.ANACONDA_ENVIRON in flags.environs: ntp_servers = self.data.timezone.ntpservers elif constants.FIRSTBOOT_ENVIRON in flags.environs: ntp_servers = ntp.get_servers_from_config()[1] # returns a (NPT pools, NTP servers) tupple else: log.error("tui time spoke: unsupported environment configuration %s," "can't decide where to get initial NTP servers", flags.environs) # check if the NTP servers appear to be working or not if ntp_servers: for server in ntp_servers: self._ntp_servers[server] = constants.NTP_SERVER_QUERY # check if the newly added NTP servers work fine self._check_ntp_servers_async(self._ntp_servers.keys()) # we assume that the NTP spoke is initialized enough even if some NTP # server check threads might still be running self.initialize_done()
def initialize(self): # We get the initial NTP servers (if any): # - from kickstart when running inside of Anaconda # during the installation # - from config files when running in Initial Setup # after the installation ntp_servers = [] if constants.ANACONDA_ENVIRON in flags.environs: ntp_servers = self.data.timezone.ntpservers elif constants.FIRSTBOOT_ENVIRON in flags.environs: ntp_servers = ntp.get_servers_from_config() else: log.error( "tui time spoke: unsupported environment configuration %s," "can't decide where to get initial NTP servers", flags.environs) # check if the NTP servers appear to be working or not if ntp_servers: for server in ntp_servers: self._ntp_servers[server] = constants.NTP_SERVER_QUERY # check if the newly added NTP servers work fine self._check_ntp_servers_async(self._ntp_servers.keys())
def _initialize_store_from_config(self): self._serversStore.clear() if self.data.timezone.ntpservers: for server in self.data.timezone.ntpservers: self._add_server(server) else: try: for server in ntp.get_servers_from_config(): self._add_server(server) except ntp.NTPconfigError: log.warning("Failed to load NTP servers configuration")
def _initialize_store_from_config(self): self._serversStore.clear() if self.data.timezone.ntpservers: pools, servers = ntp.internal_to_pools_and_servers(self.data.timezone.ntpservers) else: try: pools, servers = ntp.get_servers_from_config() except ntp.NTPconfigError: log.warning("Failed to load NTP servers configuration") return for pool in pools: self._add_server(pool, True) for server in servers: self._add_server(server, False)
def refresh(self): self._shown = True # update the displayed time self._update_datetime_timer = Timer() self._update_datetime_timer.timeout_sec(1, self._update_datetime) self._start_updating_timer = None kickstart_timezone = self._timezone_module.Timezone if is_valid_timezone(kickstart_timezone): self._tzmap.set_timezone(kickstart_timezone) time.tzset() self._update_datetime() # update the ntp configuration self._ntp_servers = TimeSourceData.from_structure_list( self._timezone_module.TimeSources) if not self._ntp_servers: try: self._ntp_servers = ntp.get_servers_from_config() except ntp.NTPconfigError: log.warning("Failed to load NTP servers configuration") self._ntp_servers_states = NTPServerStatusCache() self._ntp_servers_states.changed.connect( self._update_ntp_server_warning) has_active_network = self._network_module.Connected if not has_active_network: self._show_no_network_warning() else: self.clear_info() for server in self._ntp_servers: self._ntp_servers_states.check_status(server) if conf.system.can_set_time_synchronization: ntp_working = has_active_network and is_service_running( NTP_SERVICE) else: ntp_working = self._timezone_module.NTPEnabled self._ntpSwitch.set_active(ntp_working)
def _initialize_store_from_config(self): self._serversStore.clear() kickstart_ntp_servers = self._timezone_module.proxy.NTPServers if kickstart_ntp_servers: pools, servers = ntp.internal_to_pools_and_servers(kickstart_ntp_servers) else: try: pools, servers = ntp.get_servers_from_config() except ntp.NTPconfigError: log.warning("Failed to load NTP servers configuration") return for pool in pools: self._add_server(pool, True) for server in servers: self._add_server(server, False)