예제 #1
0
 def _software_is_ready(self):
     # FIXME:  Would be nicer to just ask the spoke if it's ready.
     return (not threadMgr.get(constants.THREAD_PAYLOAD)
             and not threadMgr.get(constants.THREAD_PAYLOAD_MD)
             and not threadMgr.get(constants.THREAD_SOFTWARE_WATCHER)
             and not threadMgr.get(constants.THREAD_CHECK_SOFTWARE)
             and self.payload.baseRepo is not None)
예제 #2
0
 def _software_is_ready(self):
     # FIXME:  Would be nicer to just ask the spoke if it's ready.
     return (not threadMgr.get(constants.THREAD_PAYLOAD) and
             not threadMgr.get(constants.THREAD_PAYLOAD_MD) and
             not threadMgr.get(constants.THREAD_SOFTWARE_WATCHER) and
             not threadMgr.get(constants.THREAD_CHECK_SOFTWARE) and
             self.payload.baseRepo is not None)
예제 #3
0
파일: source.py 프로젝트: akozumpl/anaconda
 def ready(self):
     """ Check if the spoke is ready. """
     return (
         self._ready
         and not threadMgr.get(THREAD_PAYLOAD_MD)
         and not threadMgr.get(THREAD_SOFTWARE_WATCHER)
         and not threadMgr.get(THREAD_CHECK_SOFTWARE)
     )
예제 #4
0
    def completed(self):
        retval = (threadMgr.get(constants.THREAD_EXECUTE_STORAGE) is None and
                  threadMgr.get(constants.THREAD_CHECK_STORAGE) is None and
                  self.storage.rootDevice is not None and
                  not self.errors)

        if flags.automatedInstall:
            return retval and self.data.bootloader.seen
        else:
            return retval
예제 #5
0
파일: storage.py 프로젝트: mykntom/anaconda
    def completed(self):
        retval = (threadMgr.get(constants.THREAD_EXECUTE_STORAGE) is None and
                  threadMgr.get(constants.THREAD_CHECK_STORAGE) is None and
                  self.storage.rootDevice is not None and
                  not self.errors)

        if flags.automatedInstall:
            return retval and self.data.bootloader.seen
        else:
            return retval
예제 #6
0
    def ready(self):
        # By default, the software selection spoke is not ready.  We have to
        # wait until the installation source spoke is completed.  This could be
        # because the user filled something out, or because we're done fetching
        # repo metadata from the mirror list, or we detected a DVD/CD.

        return bool(not threadMgr.get(constants.THREAD_SOFTWARE_WATCHER) and
                    not threadMgr.get(constants.THREAD_PAYLOAD_MD) and
                    not threadMgr.get(constants.THREAD_CHECK_SOFTWARE) and
                    self.payload.baseRepo is not None)
예제 #7
0
    def completed(self):
        processingDone = bool(not threadMgr.get(constants.THREAD_CHECK_SOFTWARE) and
                              not threadMgr.get(constants.THREAD_PAYLOAD) and
                              not self._errorMsgs and self.txid_valid)

        # we should always check processingDone before checking the other variables,
        # as they might be inconsistent until processing is finished
        if self._kickstarted:
            return processingDone and self.data.packages.seen
        else:
            return processingDone and self._get_selected_environment() is not None
예제 #8
0
    def completed(self):
        processingDone = bool(
            not threadMgr.get(constants.THREAD_CHECK_SOFTWARE)
            and not threadMgr.get(constants.THREAD_PAYLOAD_MD)
            and not self._errorMsgs and self.txid_valid)

        # we should always check processingDone before checking the other variables,
        # as they might be inconsistent until processing is finished
        if flags.automatedInstall:
            return processingDone and self.data.packages.seen
        else:
            return processingDone and self._get_selected_environment(
            ) is not None
예제 #9
0
파일: iscsi.py 프로젝트: mairin/anaconda
    def _check_discover(self, *args):
        if threadMgr.get(constants.THREAD_ISCSI_DISCOVER):
            return True

        # When iscsi discovery is done, update the UI.  We don't need to worry
        # about the user escaping from the dialog because all the buttons are
        # marked insensitive.
        spinner = self.builder.get_object("waitSpinner")
        spinner.stop()

        if self._discoveryError:
            # Failure.  Display some error message and leave the user on the
            # dialog to try again.
            self.builder.get_object("discoveryErrorLabel").set_text(self._discoveryError)
            self._discoveryError = None
            self._conditionNotebook.set_current_page(2)
            self._set_configure_sensitive(True)
        else:
            # Success.  Now populate the node store and kick the user on over to
            # that subscreen.
            self._add_nodes(self._discoveredNodes)
            self._iscsiNotebook.set_current_page(1)
            self._okButton.set_sensitive(True)

            # If some form of login credentials were used for discovery,
            # default to using the same for login.
            if self._authTypeCombo.get_active() != 0:
                self._loginAuthTypeCombo.set_active(3)

        # We always want to enable this button, in case the user's had enough.
        self._cancelButton.set_sensitive(True)
        return False
예제 #10
0
def wait_and_fetch_net_data(url, out_file, ca_certs=None):
    """
    Function that waits for network connection and starts a thread that fetches
    data over network.

    :see: org_fedora_oscap.data_fetch.fetch_data
    :return: the name of the thread running fetch_data
    :rtype: str

    """

    # get thread that tries to establish a network connection
    nm_conn_thread = threadMgr.get(constants.THREAD_WAIT_FOR_CONNECTING_NM)
    if nm_conn_thread:
        # NM still connecting, wait for it to finish
        nm_conn_thread.join()

    if not nm.nm_is_connected():
        raise OSCAPaddonNetworkError(
            "Network connection needed to fetch data.")

    fetch_data_thread = AnacondaThread(name=THREAD_FETCH_DATA,
                                       target=fetch_data,
                                       args=(url, out_file, ca_certs),
                                       fatal=False)

    # register and run the thread
    threadMgr.add(fetch_data_thread)

    return THREAD_FETCH_DATA
예제 #11
0
    def restartThread(self, storage, ksdata, payload, instClass, fallback=False, checkmount=True):
        """Start or restart the payload thread.

           This method starts a new thread to restart the payload thread, so
           this method's return is not blocked by waiting on the previous payload
           thread. If there is already a payload thread restart pending, this method
           has no effect.

           :param blivet.Blivet storage: The blivet storage instance
           :param kickstart.AnacondaKSHandler ksdata: The kickstart data instance
           :param packaging.Payload payload: The payload instance
           :param installclass.BaseInstallClass instClass: The install class instance
           :param bool fallback: Whether to fall back to the default repo in case of error
           :param bool checkmount: Whether to check for valid mounted media
        """

        log.debug("Restarting payload thread")

        # If a restart thread is already running, don't start a new one
        if threadMgr.get(THREAD_PAYLOAD_RESTART):
            return

        # Launch a new thread so that this method can return immediately
        threadMgr.add(AnacondaThread(name=THREAD_PAYLOAD_RESTART, target=self._restartThread,
            args=(storage, ksdata, payload, instClass, fallback, checkmount)))
예제 #12
0
    def status(self):
        """ A short string describing the current status of storage setup. """
        msg = _("No disks selected")

        if not self._confirmed:
            msg = _("Not configured")
        elif threadMgr.get(constants.THREAD_DASDFMT):
            msg = _("Formatting DASDs")
        elif flags.automatedInstall and not self.storage.rootDevice:
            return msg
        elif self.data.ignoredisk.onlyuse:
            msg = P_(("%d disk selected"), ("%d disks selected"),
                     len(self.data.ignoredisk.onlyuse)) % len(
                         self.data.ignoredisk.onlyuse)

            if self.errors:
                msg = _("Error checking storage configuration")
            elif self.warnings:
                msg = _("Warning checking storage configuration")
            elif self.data.autopart.autopart:
                msg = _("Automatic partitioning selected")
            else:
                msg = _("Custom partitioning selected")

        return msg
예제 #13
0
def wait_and_fetch_net_data(url, out_file, ca_certs=None):
    """
    Function that waits for network connection and starts a thread that fetches
    data over network.

    :see: org_fedora_oscap.data_fetch.fetch_data
    :return: the name of the thread running fetch_data
    :rtype: str

    """

    # get thread that tries to establish a network connection
    nm_conn_thread = threadMgr.get(constants.THREAD_WAIT_FOR_CONNECTING_NM)
    if nm_conn_thread:
        # NM still connecting, wait for it to finish
        nm_conn_thread.join()

    if not nm.nm_is_connected():
        raise OSCAPaddonNetworkError("Network connection needed to fetch data.")

    fetch_data_thread = AnacondaThread(name=THREAD_FETCH_DATA,
                                       target=fetch_data,
                                       args=(url, out_file, ca_certs),
                                       fatal=False)

    # register and run the thread
    threadMgr.add(fetch_data_thread)

    return THREAD_FETCH_DATA
예제 #14
0
파일: zfcp.py 프로젝트: mopsfelder/anaconda
    def _check_discover(self, *args):
        """ After the zFCP discover thread runs, check to see whether a valid
            device was discovered. Display an error message if not.

            If the discover is not done, return True to indicate that the check
            has to be run again, otherwise check the discovery and return False.
        """
        # Discovery is not done, return True.
        if threadMgr.get(constants.THREAD_ZFCP_DISCOVER):
            return True

        # Discovery has finished, run the check.
        self._spinner.stop()

        if self._discoveryError:
            # Failure, display a message and leave the user on the dialog so
            # they can try again (or cancel)
            self._errorLabel.set_text(self._discoveryError)
            self._discoveryError = None

            self._conditionNotebook.set_current_page(2)
            self._set_configure_sensitive(True)
        else:
            # Great success. Just return to the advanced storage window and let the
            # UI update with the newly-added device
            self.window.response(1)
            return False

        self._cancelButton.set_sensitive(True)
        # Discovery and the check have finished, return False.
        return False
예제 #15
0
    def refresh(self, args=None):
        NormalTUISpoke.refresh(self, args)

        # check if the storage refresh thread is running
        if threadMgr.get(THREAD_STORAGE_WATCHER):
            # storage refresh is running - just report it
            # so that the user can refresh until it is done
            # TODO: refresh once the thread is done ?
            message = _(PAYLOAD_STATUS_PROBING_STORAGE)
            self._window += [TextWidget(message), ""]
            return True

        # check if there are any mountable devices
        if self._mountable_devices:
            def _prep(i, w):
                """ Mangle our text to make it look pretty on screen. """
                number = TextWidget("%2d)" % (i + 1))
                return ColumnWidget([(4, [number]), (None, [w])], 1)

            devices = [TextWidget(d[1]) for d in self._mountable_devices]

            # gnarl and mangle all of our widgets so things look pretty on
            # screen
            choices = [_prep(i, w) for i, w in enumerate(devices)]

            displayed = ColumnWidget([(78, choices)], 1)
            self._window.append(displayed)

        else:
            message = _("No mountable devices found")
            self._window += [TextWidget(message), ""]
        return True
예제 #16
0
파일: source.py 프로젝트: LiuCan01/anaconda
    def refresh(self, args=None):
        NormalTUISpoke.refresh(self, args)

        # check if the storage refresh thread is running
        if threadMgr.get(THREAD_STORAGE_WATCHER):
            # storage refresh is running - just report it
            # so that the user can refresh until it is done
            # TODO: refresh once the thread is done ?
            message = _("Probing storage...")
            self._window += [TextWidget(message), ""]
            return True

        # check if there are any mountable devices
        if self._mountable_devices:

            def _prep(i, w):
                """ Mangle our text to make it look pretty on screen. """
                number = TextWidget("%2d)" % (i + 1))
                return ColumnWidget([(4, [number]), (None, [w])], 1)

            devices = [TextWidget(d[1]) for d in self._mountable_devices]

            # gnarl and mangle all of our widgets so things look pretty on
            # screen
            choices = [_prep(i, w) for i, w in enumerate(devices)]

            displayed = ColumnWidget([(78, choices)], 1)
            self._window.append(displayed)

        else:
            message = _("No mountable devices found")
            self._window += [TextWidget(message), ""]
        return True
예제 #17
0
파일: iscsi.py 프로젝트: LiuCan01/anaconda
    def _check_discover(self, *args):
        if threadMgr.get(constants.THREAD_ISCSI_DISCOVER):
            return True

        # When iscsi discovery is done, update the UI.  We don't need to worry
        # about the user escaping from the dialog because all the buttons are
        # marked insensitive.
        spinner = self.builder.get_object("waitSpinner")
        spinner.stop()

        if self._discoveryError:
            # Failure.  Display some error message and leave the user on the
            # dialog to try again.
            self.builder.get_object("discoveryErrorLabel").set_text(
                self._discoveryError)
            self._discoveryError = None
            self._conditionNotebook.set_current_page(2)
            self._set_configure_sensitive(True)
        else:
            # Success.  Now populate the node store and kick the user on over to
            # that subscreen.
            self._add_nodes(self._discoveredNodes)
            self._iscsiNotebook.set_current_page(1)
            self._okButton.set_sensitive(True)

            # If some form of login credentials were used for discovery,
            # default to using the same for login.
            if self._authTypeCombo.get_active() != 0:
                self._loginAuthTypeCombo.set_active(3)

        # We always want to enable this button, in case the user's had enough.
        self._cancelButton.set_sensitive(True)
        return False
예제 #18
0
파일: dasd.py 프로젝트: mopsfelder/anaconda
    def _check_discover(self):
        """ After the DASD discover thread runs, check to see whether a valid
            device was discovered. Display an error message if not.

            If the discover is not done, return True to indicate that the check
            has to be run again, otherwise check the discovery and return False.
        """
        # Discovery is not done, return True.
        if threadMgr.get(constants.THREAD_DASD_DISCOVER):
            return True

        # Discovery has finished, run the check.
        self._spinner.stop()

        if self._discoveryError:
            # Failure, display a message and leave the user on the dialog so
            # they can try again (or cancel)
            self._errorLabel.set_text(self._discoveryError)
            self._discoveryError = None

            self._deviceEntry.set_sensitive(True)
            self._conditionNotebook.set_current_page(2)
        else:
            # Great success. Since DASDs go under local disks, update dialog to
            # show users that's where they'll be
            self._okButton.set_sensitive(True)
            self._conditionNotebook.set_current_page(3)

        self._cancelButton.set_sensitive(True)
        # Discovery and the check have finished, return False.
        return False
예제 #19
0
    def restartThread(self,
                      storage,
                      ksdata,
                      payload,
                      instClass,
                      fallback=False,
                      checkmount=True):
        """Start or restart the payload thread.

           This method starts a new thread to restart the payload thread, so
           this method's return is not blocked by waiting on the previous payload
           thread. If there is already a payload thread restart pending, this method
           has no effect.

           :param blivet.Blivet storage: The blivet storage instance
           :param kickstart.AnacondaKSHandler ksdata: The kickstart data instance
           :param packaging.Payload payload: The payload instance
           :param installclass.BaseInstallClass instClass: The install class instance
           :param bool fallback: Whether to fall back to the default repo in case of error
           :param bool checkmount: Whether to check for valid mounted media
        """

        log.debug("Restarting payload thread")

        # If a restart thread is already running, don't start a new one
        if threadMgr.get(THREAD_PAYLOAD_RESTART):
            return

        # Launch a new thread so that this method can return immediately
        threadMgr.add(
            AnacondaThread(name=THREAD_PAYLOAD_RESTART,
                           target=self._restartThread,
                           args=(storage, ksdata, payload, instClass, fallback,
                                 checkmount)))
예제 #20
0
    def completed(self):
        processingDone = not threadMgr.get(constants.THREAD_CHECK_SOFTWARE) and \
                         not self._errorMsgs and self.txid_valid

        if flags.automatedInstall:
            return processingDone and self.data.packages.seen
        else:
            return self._get_selected_environment() is not None and processingDone
예제 #21
0
    def completed(self):
        """ Make sure our threads are done running and vars are set. """
        processingDone = not threadMgr.get(THREAD_CHECK_SOFTWARE) and \
                         not self.errors and self.txid_valid

        if flags.automatedInstall:
            return processingDone and self.payload.baseRepo and self.data.packages.seen
        else:
            return self.payload.baseRepo and self.environment is not None and processingDone
예제 #22
0
    def completed(self):
        """ Make sure our threads are done running and vars are set. """
        processingDone = not threadMgr.get(THREAD_CHECK_SOFTWARE) and \
                         not self.errors and self.txid_valid

        if flags.automatedInstall:
            return processingDone and self.payload.baseRepo and self.data.packages.seen
        else:
            return self.payload.baseRepo and self.environment is not None and processingDone
예제 #23
0
    def completed(self):
        processingDone = bool(not threadMgr.get(constants.THREAD_CHECK_SOFTWARE) and
                              not threadMgr.get(constants.THREAD_PAYLOAD) and
                              not self._errorMsgs and self.txid_valid)

        # * we should always check processingDone before checking the other variables,
        #   as they might be inconsistent until processing is finished
        # * we can't let the installation proceed until a valid environment has been set
        if processingDone:
            if self.environment is not None:
                # if we have environment it needs to be valid
                return self.environment_valid
            # if we don't have environment we need to at least have the %packages
            # section in kickstart
            elif flags.automatedInstall and self.data.packages.seen:
                return True
            # no environment and no %packages section -> manual intervention is needed
            else:
                return False
        else:
            return False
예제 #24
0
    def _initialize(self):
        for day in xrange(1, 32):
            self.add_to_store(self._daysStore, day)

        for i in xrange(1, 13):
            #a bit hacky way, but should return the translated string
            #TODO: how to handle language change? Clear and populate again?
            month = datetime.date(2000, i, 1).strftime('%B')
            self.add_to_store(self._monthsStore, month)
            self._months_nums[month] = i

        for year in xrange(1990, 2051):
            self.add_to_store(self._yearsStore, year)

        cities = set()
        xlated_regions = ((region, get_xlated_timezone(region))
                          for region in self._regions_zones.iterkeys())
        for region, xlated in sorted(xlated_regions, cmp=_compare_regions):
            self.add_to_store_xlated(self._regionsStore, region, xlated)
            for city in self._regions_zones[region]:
                cities.add((city, get_xlated_timezone(city)))

        for city, xlated in sorted(cities, cmp=_compare_cities):
            self.add_to_store_xlated(self._citiesStore, city, xlated)

        if self._radioButton24h.get_active():
            self._set_amPm_part_sensitive(False)

        self._update_datetime_timer_id = None
        if is_valid_timezone(self.data.timezone.timezone):
            self._set_timezone(self.data.timezone.timezone)
        elif not flags.flags.automatedInstall:
            log.warning(
                "%s is not a valid timezone, falling back to default (%s)",
                self.data.timezone.timezone, DEFAULT_TZ)
            self._set_timezone(DEFAULT_TZ)
            self.data.timezone.timezone = DEFAULT_TZ

        if not flags.can_touch_runtime_system("modify system time and date"):
            self._set_date_time_setting_sensitive(False)

        self._config_dialog = NTPconfigDialog(self.data)
        self._config_dialog.initialize()

        time_init_thread = threadMgr.get(constants.THREAD_TIME_INIT)
        if time_init_thread is not None:
            hubQ.send_message(self.__class__.__name__,
                              _("Restoring hardware time..."))
            threadMgr.wait(constants.THREAD_TIME_INIT)

        hubQ.send_ready(self.__class__.__name__, False)
    def _initialize(self):
        for day in xrange(1, 32):
            self.add_to_store(self._daysStore, day)

        for i in xrange(1, 13):
            #a bit hacky way, but should return the translated string
            #TODO: how to handle language change? Clear and populate again?
            month = datetime.date(2000, i, 1).strftime('%B')
            self.add_to_store(self._monthsStore, month)
            self._months_nums[month] = i

        for year in xrange(1990, 2051):
            self.add_to_store(self._yearsStore, year)

        cities = set()
        xlated_regions = ((region, get_xlated_timezone(region))
                          for region in self._regions_zones.iterkeys())
        for region, xlated in sorted(xlated_regions, cmp=_compare_regions):
            self.add_to_store_xlated(self._regionsStore, region, xlated)
            for city in self._regions_zones[region]:
                cities.add((city, get_xlated_timezone(city)))

        for city, xlated in sorted(cities, cmp=_compare_cities):
            self.add_to_store_xlated(self._citiesStore, city, xlated)

        if self._radioButton24h.get_active():
            self._set_amPm_part_sensitive(False)

        self._update_datetime_timer_id = None
        if is_valid_timezone(self.data.timezone.timezone):
            self._set_timezone(self.data.timezone.timezone)
        elif not flags.flags.automatedInstall:
            log.warning("%s is not a valid timezone, falling back to default (%s)",
                        self.data.timezone.timezone, DEFAULT_TZ)
            self._set_timezone(DEFAULT_TZ)
            self.data.timezone.timezone = DEFAULT_TZ

        if not flags.can_touch_runtime_system("modify system time and date"):
            self._set_date_time_setting_sensitive(False)

        self._config_dialog = NTPconfigDialog(self.data)
        self._config_dialog.initialize()

        time_init_thread = threadMgr.get(constants.THREAD_TIME_INIT)
        if time_init_thread is not None:
            hubQ.send_message(self.__class__.__name__,
                             _("Restoring hardware time..."))
            threadMgr.wait(constants.THREAD_TIME_INIT)

        hubQ.send_ready(self.__class__.__name__, False)
예제 #26
0
    def refresh(self):
        """Refresh location info"""
        # first check if a provider is available
        if self._provider is None:
            log.error("Geoloc: can't refresh - no provider")
            return

        # then check if a refresh is already in progress
        if threadMgr.get(constants.THREAD_GEOLOCATION_REFRESH):
            log.debug("Geoloc: refresh already in progress")
        else:  # wait for Internet connectivity
            if network.wait_for_connectivity():
                threadMgr.add(AnacondaThread(name=constants.THREAD_GEOLOCATION_REFRESH, target=self._provider.refresh))
            else:
                log.error("Geolocation refresh failed" " - no connectivity")
예제 #27
0
    def refresh(self):
        """Refresh location info"""
        # first check if a provider is available
        if self._provider is None:
            log.error("Geoloc: can't refresh - no provider")
            return

        # then check if a refresh is already in progress
        if threadMgr.get(constants.THREAD_GEOLOCATION_REFRESH):
            log.debug("Geoloc: refresh already in progress")
        else:  # wait for Internet connectivity
            if network.wait_for_connectivity():
                threadMgr.add(
                    AnacondaThread(name=constants.THREAD_GEOLOCATION_REFRESH,
                                   target=self._provider.refresh))
            else:
                log.error("Geolocation refresh failed" " - no connectivity")
예제 #28
0
    def _initialize(self):
        # a bit hacky way, but should return the translated strings
        for i in range(1, 32):
            day = datetime.date(2000, 1, i).strftime(self._day_format)
            self.add_to_store_idx(self._daysStore, i, day)

        for i in range(1, 13):
            month = datetime.date(2000, i, 1).strftime(self._month_format)
            self.add_to_store_idx(self._monthsStore, i, month)

        for i in range(1990, 2051):
            year = datetime.date(i, 1, 1).strftime(self._year_format)
            self.add_to_store_idx(self._yearsStore, i, year)

        cities = set()
        xlated_regions = ((region, get_xlated_timezone(region))
                          for region in self._regions_zones.keys())
        for region, xlated in sorted(xlated_regions, key=functools.cmp_to_key(_compare_regions)):
            self.add_to_store_xlated(self._regionsStore, region, xlated)
            for city in self._regions_zones[region]:
                cities.add((city, get_xlated_timezone(city)))

        for city, xlated in sorted(cities, key=functools.cmp_to_key(_compare_cities)):
            self.add_to_store_xlated(self._citiesStore, city, xlated)

        self._update_datetime_timer_id = None
        if is_valid_timezone(self.data.timezone.timezone):
            self._set_timezone(self.data.timezone.timezone)
        elif not flags.flags.automatedInstall:
            log.warning("%s is not a valid timezone, falling back to default (%s)",
                        self.data.timezone.timezone, DEFAULT_TZ)
            self._set_timezone(DEFAULT_TZ)
            self.data.timezone.timezone = DEFAULT_TZ

        time_init_thread = threadMgr.get(constants.THREAD_TIME_INIT)
        if time_init_thread is not None:
            hubQ.send_message(self.__class__.__name__,
                             _("Restoring hardware time..."))
            threadMgr.wait(constants.THREAD_TIME_INIT)

        hubQ.send_ready(self.__class__.__name__, False)

        # report that we are done
        self.initialize_done()
예제 #29
0
    def _initialize(self):
        # a bit hacky way, but should return the translated strings
        for i in range(1, 32):
            day = datetime.date(2000, 1, i).strftime(self._day_format)
            self.add_to_store_idx(self._daysStore, i, day)

        for i in range(1, 13):
            month = datetime.date(2000, i, 1).strftime(self._month_format)
            self.add_to_store_idx(self._monthsStore, i, month)

        for i in range(1990, 2051):
            year = datetime.date(i, 1, 1).strftime(self._year_format)
            self.add_to_store_idx(self._yearsStore, i, year)

        cities = set()
        xlated_regions = ((region, get_xlated_timezone(region))
                          for region in self._regions_zones.keys())
        for region, xlated in sorted(
                xlated_regions, key=functools.cmp_to_key(_compare_regions)):
            self.add_to_store_xlated(self._regionsStore, region, xlated)
            for city in self._regions_zones[region]:
                cities.add((city, get_xlated_timezone(city)))

        for city, xlated in sorted(cities,
                                   key=functools.cmp_to_key(_compare_cities)):
            self.add_to_store_xlated(self._citiesStore, city, xlated)

        self._update_datetime_timer_id = None
        if is_valid_timezone(self.data.timezone.timezone):
            self._set_timezone(self.data.timezone.timezone)
        elif not flags.flags.automatedInstall:
            log.warning(
                "%s is not a valid timezone, falling back to default (%s)",
                self.data.timezone.timezone, DEFAULT_TZ)
            self._set_timezone(DEFAULT_TZ)
            self.data.timezone.timezone = DEFAULT_TZ

        time_init_thread = threadMgr.get(constants.THREAD_TIME_INIT)
        if time_init_thread is not None:
            hubQ.send_message(self.__class__.__name__,
                              _("Restoring hardware time..."))
            threadMgr.wait(constants.THREAD_TIME_INIT)

        hubQ.send_ready(self.__class__.__name__, False)
예제 #30
0
파일: iscsi.py 프로젝트: LiuCan01/anaconda
    def _check_login(self, *args):
        if threadMgr.get(constants.THREAD_ISCSI_LOGIN):
            return True

        spinner = self.builder.get_object("loginSpinner")
        spinner.stop()
        spinner.hide()

        if self._loginError:
            self.builder.get_object("loginErrorLabel").set_text(
                self._loginError)
            self._loginError = None
            self._loginConditionNotebook.set_current_page(1)
            self._cancelButton.set_sensitive(True)
            self._loginButton.set_sensitive(True)
        else:
            anyLeft = False

            self._loginConditionNotebook.set_current_page(0)

            # Select the now-first target for the user in case they want to
            # log into another one.
            for row in self._store:
                if row[1]:
                    row[0] = True
                    anyLeft = True

                    # And make the login button sensitive if there are any more
                    # nodes to login to.
                    self._loginButton.set_sensitive(True)
                    break

            self._okButton.set_sensitive(True)

            # Once a node has been logged into, it doesn't make much sense to let
            # the user cancel.  Cancel what, exactly?
            self._cancelButton.set_sensitive(False)

            if not anyLeft:
                self.window.response(1)

        self._set_login_sensitive(True)
        return False
예제 #31
0
파일: iscsi.py 프로젝트: mairin/anaconda
    def _check_login(self, *args):
        if threadMgr.get(constants.THREAD_ISCSI_LOGIN):
            return True

        spinner = self.builder.get_object("loginSpinner")
        spinner.stop()
        spinner.hide()

        if self._loginError:
            self.builder.get_object("loginErrorLabel").set_text(self._loginError)
            self._loginError = None
            self._loginConditionNotebook.set_current_page(1)
            self._cancelButton.set_sensitive(True)
            self._loginButton.set_sensitive(True)
        else:
            anyLeft = False

            self._loginConditionNotebook.set_current_page(0)

            # Select the now-first target for the user in case they want to
            # log into another one.
            for row in self._store:
                if row[1]:
                    row[0] = True
                    anyLeft = True

                    # And make the login button sensitive if there are any more
                    # nodes to login to.
                    self._loginButton.set_sensitive(True)
                    break

            self._okButton.set_sensitive(True)

            # Once a node has been logged into, it doesn't make much sense to let
            # the user cancel.  Cancel what, exactly?
            self._cancelButton.set_sensitive(False)

            if not anyLeft:
                self.window.response(1)

        self._set_login_sensitive(True)
        return False
예제 #32
0
파일: ntp.py 프로젝트: megaumi/anaconda
def one_time_sync_async(server, callback=None):
    """
    Asynchronously synchronize the system time with a given NTP server. This
    function is non-blocking it starts a new thread for synchronization and
    returns. Use callback argument to specify the function called when the
    new thread finishes if needed.

    :param server: NTP server
    :param callback: callback function to run after sync or failure
    :type callback: a function taking one boolean argument (success)

    """

    thread_name = "%s_%s" % (THREAD_SYNC_TIME_BASENAME, server)
    if threadMgr.get(thread_name):
        #syncing with the same server running
        return

    threadMgr.add(AnacondaThread(name=thread_name, target=one_time_sync,
                                 args=(server, callback)))
예제 #33
0
    def _check_rescan(self, *args):
        if threadMgr.get(constants.THREAD_STORAGE):
            self._elapsed += 1

            # If more than five seconds has elapsed since the rescan started,
            # give the user the option to return to the hub.
            if self._elapsed >= 5:
                self._notebook.set_current_page(2)

            return True

        # Seems a little silly to have this warning text still displayed
        # when everything is done.
        box = self.builder.get_object("warningBox")
        box.set_visible(False)

        self._cancel_button.set_sensitive(False)
        self._ok_button.set_sensitive(True)
        self._notebook.set_current_page(3)
        return False
예제 #34
0
파일: refresh.py 프로젝트: numbnet/anaconda
    def _check_rescan(self, *args):
        if threadMgr.get(constants.THREAD_STORAGE):
            self._elapsed += 1

            # If more than five seconds has elapsed since the rescan started,
            # give the user the option to return to the hub.
            if self._elapsed >= 5:
                self._notebook.set_current_page(2)

            return True

        # Seems a little silly to have this warning text still displayed
        # when everything is done.
        box = self.builder.get_object("warningBox")
        box.set_visible(False)

        self._cancel_button.set_sensitive(False)
        self._ok_button.set_sensitive(True)
        self._notebook.set_current_page(3)
        return False
예제 #35
0
파일: ntp.py 프로젝트: nullr0ute/anaconda
def one_time_sync_async(server, callback=None):
    """
    Asynchronously synchronize the system time with a given NTP server. This
    function is non-blocking it starts a new thread for synchronization and
    returns. Use callback argument to specify the function called when the
    new thread finishes if needed.

    :param server: NTP server
    :param callback: callback function to run after sync or failure
    :type callback: a function taking one boolean argument (success)

    """

    thread_name = "%s_%s" % (THREAD_SYNC_TIME_BASENAME, server)
    if threadMgr.get(thread_name):
        #syncing with the same server running
        return

    threadMgr.add(AnacondaThread(name=thread_name, target=one_time_sync,
                                 args=(server, callback)))
예제 #36
0
파일: source.py 프로젝트: Sabayon/anaconda
 def status(self):
     if threadMgr.get(constants.THREAD_CHECK_SOFTWARE):
         return _("Checking software dependencies...")
     elif not self.ready:
         return _(BASEREPO_SETUP_MESSAGE)
     elif self._error or not self.payload.baseRepo:
         return _("Error setting up software source")
     elif self.data.method.method == "url":
         return self.data.method.url or self.data.method.mirrorlist
     elif self.data.method.method == "nfs":
         return _("NFS server %s") % self.data.method.server
     elif self.data.method.method == "cdrom":
         return _("CD/DVD drive")
     elif self.data.method.method == "harddrive":
         if not self._currentIsoFile:
             return _("Error setting up software source")
         return os.path.basename(self._currentIsoFile)
     elif self.payload.baseRepo:
         return _("Closest mirror")
     else:
         return _("Nothing selected")
예제 #37
0
파일: source.py 프로젝트: mykntom/anaconda
 def status(self):
     if threadMgr.get(constants.THREAD_CHECK_SOFTWARE):
         return _("Checking software dependencies...")
     elif not self.ready:
         return _(BASEREPO_SETUP_MESSAGE)
     elif self._error or not self.payload.baseRepo:
         return _("Error setting up software source")
     elif self.data.method.method == "url":
         return self.data.method.url or self.data.method.mirrorlist
     elif self.data.method.method == "nfs":
         return _("NFS server %s") % self.data.method.server
     elif self.data.method.method == "cdrom":
         return _("CD/DVD drive")
     elif self.data.method.method == "harddrive":
         if not self._currentIsoFile:
             return _("Error setting up software source")
         return os.path.basename(self._currentIsoFile)
     elif self.payload.baseRepo:
         return _("Closest mirror")
     else:
         return _("Nothing selected")
예제 #38
0
    def status(self):
        """ A short string describing the current status of storage setup. """
        msg = _("No disks selected")

        if flags.automatedInstall and not self.storage.rootDevice:
            msg = _("Kickstart insufficient")
        elif threadMgr.get(constants.THREAD_DASDFMT):
            msg = _("Formatting DASDs")
        elif self.data.ignoredisk.onlyuse:
            msg = P_(("%d disk selected"),
                     ("%d disks selected"),
                     len(self.data.ignoredisk.onlyuse)) % len(self.data.ignoredisk.onlyuse)

            if self.errors:
                msg = _("Error checking storage configuration")
            elif self.warnings:
                msg = _("Warning checking storage configuration")
            elif self.data.autopart.autopart:
                msg = _("Automatic partitioning selected")
            else:
                msg = _("Custom partitioning selected")

        return msg
예제 #39
0
 def ready(self):
     return not threadMgr.get("AnaDateTimeThread")
예제 #40
0
 def ready(self):
     """ If we're ready to move on. """
     return (not threadMgr.get(THREAD_SOFTWARE_WATCHER) and
             not threadMgr.get(THREAD_PAYLOAD_MD) and
             not threadMgr.get(THREAD_CHECK_SOFTWARE))
예제 #41
0
 def ready(self):
     from pyanaconda.threads import threadMgr
     return (self._ready and not threadMgr.get(constants.THREAD_PAYLOAD_MD)
             and not threadMgr.get(constants.THREAD_SOFTWARE_WATCHER)
             and not threadMgr.get(constants.THREAD_CHECK_SOFTWARE))
예제 #42
0
 def ready(self):
     from pyanaconda.threads import threadMgr
     return (self._ready and
             not threadMgr.get(constants.THREAD_PAYLOAD_MD) and
             not threadMgr.get(constants.THREAD_SOFTWARE_WATCHER) and
             not threadMgr.get(constants.THREAD_CHECK_SOFTWARE))
예제 #43
0
 def ready(self):
     return self._ready and threadMgr.get(
         ADD_LAYOUTS_INITIALIZE_THREAD) is None
예제 #44
0
 def ready(self):
     return self._ready and threadMgr.get(ADD_LAYOUTS_INITIALIZE_THREAD) is None
 def ready(self):
     return not threadMgr.get("AnaDateTimeThread")
예제 #46
0
 def ready(self):
     """ If we're ready to move on. """
     return (not threadMgr.get(THREAD_SOFTWARE_WATCHER) and
             not threadMgr.get(THREAD_PAYLOAD_MD) and
             not threadMgr.get(THREAD_CHECK_SOFTWARE) and
             self.payload.baseRepo is not None)
예제 #47
0
 def ready(self):
     return (self._ready and
             not threadMgr.get(constants.THREAD_PAYLOAD_MD) and
             not threadMgr.get(constants.THREAD_SOFTWARE_WATCHER) and
             not threadMgr.get(constants.THREAD_CHECK_SOFTWARE))
예제 #48
0
 def ready(self):
     return (self._ready and not threadMgr.get(constants.THREAD_PAYLOAD_MD)
             and not threadMgr.get(constants.THREAD_SOFTWARE_WATCHER)
             and not threadMgr.get(constants.THREAD_CHECK_SOFTWARE))
예제 #49
0
 def completed(self):
     retval = (threadMgr.get(constants.THREAD_EXECUTE_STORAGE) is None and
               threadMgr.get(constants.THREAD_CHECK_STORAGE) is None and
               self.storage.rootDevice is not None and
               not self.errors)
     return retval
예제 #50
0
 def ready(self):
     """ Check if the spoke is ready. """
     return (self._ready and not threadMgr.get(THREAD_PAYLOAD_MD)
             and not threadMgr.get(THREAD_SOFTWARE_WATCHER)
             and not threadMgr.get(THREAD_CHECK_SOFTWARE))
예제 #51
0
 def ready(self):
     # By default, the storage spoke is not ready.  We have to wait until
     # storageInitialize is done.
     return self._ready and not (threadMgr.get(THREAD_STORAGE_WATCHER)
                                 or threadMgr.get(THREAD_DASDFMT))
예제 #52
0
 def completed(self):
     retval = (threadMgr.get(constants.THREAD_EXECUTE_STORAGE) is None
               and threadMgr.get(constants.THREAD_CHECK_STORAGE) is None
               and self.storage.rootDevice is not None and not self.errors)
     return retval
예제 #53
0
 def ready(self):
     """ If we're ready to move on. """
     return (not threadMgr.get(THREAD_PAYLOAD)
             and not threadMgr.get(THREAD_CHECK_SOFTWARE)
             and not threadMgr.get(THREAD_SOFTWARE_WATCHER))
예제 #54
0
 def ready(self):
     # By default, the storage spoke is not ready.  We have to wait until
     # storageInitialize is done.
     return self._ready and not (threadMgr.get(THREAD_STORAGE_WATCHER) or threadMgr.get(THREAD_DASDFMT))
예제 #55
0
 def ready(self):
     """ If we're ready to move on. """
     return (not threadMgr.get(THREAD_SOFTWARE_WATCHER) and
             not threadMgr.get(THREAD_PAYLOAD_MD) and
             not threadMgr.get(THREAD_CHECK_SOFTWARE) and
             self.payload.baseRepo is not None)