Ejemplo n.º 1
0
 def checkSoftwareSelection(self):
     from pyanaconda.packaging import DependencyError
     hubQ.send_message(self.__class__.__name__,
                       _("Checking software dependencies..."))
     try:
         self.payload.checkSoftwareSelection()
     except DependencyError as e:
         self._errorMsgs = "\n".join(sorted(e.message))
         hubQ.send_message(self.__class__.__name__,
                           _("Error checking software dependencies"))
         self._tx_id = None
     else:
         self._errorMsgs = None
         # If we are installing with a kickstart that does not specify packages,
         # we want the user to enter the Software spoke and confirm the software
         # selection. We do this be by resetting the transaction id, which
         # forces the user to visit the spoke and also makes sure any changes
         # the user does in the spoke are respected.
         if flags.automatedInstall and not self.data.packages.seen:
             self._tx_id = None
         else:
             self._tx_id = self.payload.txID
     finally:
         hubQ.send_ready(self.__class__.__name__, False)
         hubQ.send_ready("SourceSpoke", False)
Ejemplo n.º 2
0
    def apply(self):
        # Copy data from the UI back to the kickstart object
        homedir = self._tHome.get_text()

        # If the user cleared the home directory, revert back to the
        # default
        if not homedir:
            self._user.homedir = None
        # If the user modified the home directory input, save that the
        # home directory has been modified and use the value.
        elif self._origHome != homedir:
            if not os.path.isabs(homedir):
                homedir = "/" + homedir
            self._user.homedir = homedir

        # Otherwise leave the home directory alone. If the home
        # directory is currently the default value, the next call
        # to refresh() will update the input text to reflect
        # changes in the username.

        if self._cUid.get_active():
            self._user.uid = int(self._uid.get_value())
        else:
            self._user.uid = None

        if self._cGid.get_active():
            self._user.gid = int(self._gid.get_value())
        else:
            self._user.gid = None

        # ''.split(',') returns [''] instead of [], which is not what we want
        self._user.groups = [g.strip() for g in self._tGroups.get_text().split(",") if g]

        # Send ready signal to main event loop
        hubQ.send_ready(self.__class__.__name__, False)
Ejemplo n.º 3
0
    def ready(self):
        """
        The ready property that tells whether the spoke is ready (can be visited)
        or not. The spoke is made (in)sensitive based on the returned value.

        :rtype: bool

        """

        # Check if the hostname starts with "localhost"
        # if
        myHostname = subprocess.check_output(['hostname', '-s']).strip()
        if myHostname.startswith("localhost"):
            self.readyState = BADHOSTNAME
            return False
        # if the readyState was BADHOSTNAME return to CONFIGURE state
        # send a message to Hub that we are now ready (only way to
        # to remove this spoke from _notReady list
        if self.readyState == BADHOSTNAME:
            self.readyState = CONFIGURE
            hubQ.send_ready(self.__class__.__name__, True)
        if self.readyState == BUILDING:
            self.log.info("rocks_rolls.py:building db (ready)")
            return False
        self.log.info("rocks_rolls.py:ready")
        return True
Ejemplo n.º 4
0
 def _doExecute(self):
     self._ready = False
     hubQ.send_not_ready(self.__class__.__name__)
     hubQ.send_message(self.__class__.__name__, _("Saving storage configuration..."))
     try:
         doKickstartStorage(self.storage, self.data, self.instclass)
     except (StorageError, KickstartValueError) as e:
         log.error("storage configuration failed: %s", e)
         StorageChecker.errors = str(e).split("\n")
         hubQ.send_message(self.__class__.__name__, _("Failed to save storage configuration..."))
         self.data.bootloader.bootDrive = ""
         self.data.ignoredisk.drives = []
         self.data.ignoredisk.onlyuse = []
         self.storage.config.update(self.data)
         self.storage.reset()
         self.disks = getDisks(self.storage.devicetree)
         # now set ksdata back to the user's specified config
         self._applyDiskSelection(self.selected_disks)
     except BootLoaderError as e:
         log.error("BootLoader setup failed: %s", e)
         StorageChecker.errors = str(e).split("\n")
         hubQ.send_message(self.__class__.__name__, _("Failed to save storage configuration..."))
         self.data.bootloader.bootDrive = ""
     else:
         if self.autopart:
             # this was already run as part of doAutoPartition. dumb.
             StorageChecker.errors = []
             StorageChecker.warnings = []
             self.run()
     finally:
         self._ready = True
         hubQ.send_ready(self.__class__.__name__, True)
Ejemplo n.º 5
0
    def apply(self):
        pw = self.password

        enabled = self.root_enabled
        self._users_module.SetRootAccountLocked(not enabled)

        if enabled:
            # the checkbox makes it possible to override the default Open SSH
            # policy of not allowing root to login with password
            ssh_login_override = self._root_password_ssh_login_override.get_active(
            )
            self._users_module.SetRootPasswordSSHLoginAllowed(
                ssh_login_override)

        if not pw:
            self._users_module.ClearRootPassword()
            return

        # we have a password - set it to kickstart data
        self._users_module.SetCryptedRootPassword(crypt_password(pw))

        # clear any placeholders
        self.remove_placeholder_texts()

        # Send ready signal to main event loop
        hubQ.send_ready(self.__class__.__name__)
Ejemplo n.º 6
0
    def ready(self):
        """
        The ready property that tells whether the spoke is ready (can be visited)
        or not. The spoke is made (in)sensitive based on the returned value.

        :rtype: bool

        """
        ## Let's see if we have a network default route set
        try:
            device = network.default_route_device()
            if device is None:
                self.readyState = False
                return False
        except:
            self.readyState = False
            return False

        # When we change from not ready to ready, send a HubQ message
        if self.readyState is False:
            self.readyState = True
            hubQ.send_ready(self.__class__.__name__, True)

        self.log.info("rocks_info.py:ready")
        return True
Ejemplo n.º 7
0
 def _doExecute(self):
     self._ready = False
     hubQ.send_not_ready(self.__class__.__name__)
     hubQ.send_message(self.__class__.__name__,
                       _("Saving storage configuration..."))
     try:
         doKickstartStorage(self.storage, self.data, self.instclass)
     except (StorageError, KickstartValueError) as e:
         log.error("storage configuration failed: %s", e)
         StorageChecker.errors = str(e).split("\n")
         hubQ.send_message(self.__class__.__name__,
                           _("Failed to save storage configuration..."))
         self.data.bootloader.bootDrive = ""
         self.data.ignoredisk.drives = []
         self.data.ignoredisk.onlyuse = []
         self.storage.config.update(self.data)
         self.storage.reset()
         self.disks = getDisks(self.storage.devicetree)
         # now set ksdata back to the user's specified config
         self._applyDiskSelection(self.selected_disks)
     except BootLoaderError as e:
         log.error("BootLoader setup failed: %s", e)
         StorageChecker.errors = str(e).split("\n")
         hubQ.send_message(self.__class__.__name__,
                           _("Failed to save storage configuration..."))
         self.data.bootloader.bootDrive = ""
     else:
         if self.autopart:
             # this was already run as part of doAutoPartition. dumb.
             StorageChecker.errors = []
             StorageChecker.warnings = []
             self.run()
     finally:
         self._ready = True
         hubQ.send_ready(self.__class__.__name__, True)
Ejemplo n.º 8
0
    def ready(self):
        """
        The ready property that tells whether the spoke is ready (can be visited)
        or not. The spoke is made (in)sensitive based on the returned value.

        :rtype: bool

        """

        # Check if the hostname starts with "localhost"
        # if
        myHostname = subprocess.check_output(['hostname','-s']).strip()
        if myHostname.startswith("localhost"):
            self.readyState=BADHOSTNAME
            return False
        # if the readyState was BADHOSTNAME return to CONFIGURE state
        # send a message to Hub that we are now ready (only way to
        # to remove this spoke from _notReady list
        if self.readyState == BADHOSTNAME:
            self.readyState = CONFIGURE
            hubQ.send_ready(self.__class__.__name__, True)
        if self.readyState == BUILDING:
            self.log.info("rocks_rolls.py:building db (ready)")
            return False            
        self.log.info("rocks_rolls.py:ready")
        return True
Ejemplo n.º 9
0
    def _initialize(self):
        threadMgr.wait(constants.THREAD_PAYLOAD)
        # Select groups which should be selected by kickstart
        try:
            for group in self.payload.selectedGroupsIDs():
                if self.environment and self.payload.environmentOptionIsDefault(self.environment, group):
                    self._addonStates[group] = self._ADDON_DEFAULT
                else:
                    self._addonStates[group] = self._ADDON_SELECTED
        except PayloadError as e:
            # Group translation is not supported
            log.warning(e)
            # It's better to have all or nothing selected from kickstart
            self._addonStates = {}

        if not self._kickstarted:
            # having done all the slow downloading, we need to do the first refresh
            # of the UI here so there's an environment selected by default.  This
            # happens inside the main thread by necessity.  We can't do anything
            # that takes any real amount of time, or it'll block the UI from
            # updating.
            if not self._first_refresh():
                return

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

        # If packages were provided by an input kickstart file (or some other means),
        # we should do dependency solving here.
        if not self._error:
            self._apply()

        # report that software spoke initialization has been completed
        self.initialize_done()
Ejemplo n.º 10
0
    def _wait_ready(self):
        self._add_dialog.wait_initialize()
        self._ready = True
        hubQ.send_ready(self.__class__.__name__, False)

        # report that the keyboard spoke initialization has been completed
        self.initialize_done()
Ejemplo n.º 11
0
 def _doExecute(self):
     self._ready = False
     hubQ.send_not_ready(self.__class__.__name__)
     # on the off-chance dasdfmt is running, we can't proceed further
     threadMgr.wait(constants.THREAD_DASDFMT)
     hubQ.send_message(self.__class__.__name__, _("Saving storage configuration..."))
     try:
         doKickstartStorage(self.storage, self.data, self.instclass)
     except (StorageError, KickstartValueError) as e:
         log.error("storage configuration failed: %s", e)
         StorageChecker.errors = str(e).split("\n")
         hubQ.send_message(self.__class__.__name__, _("Failed to save storage configuration..."))
         self.data.bootloader.bootDrive = ""
         self.data.ignoredisk.drives = []
         self.data.ignoredisk.onlyuse = []
         self.storage.config.update(self.data)
         self.storage.reset()
         self.disks = getDisks(self.storage.devicetree)
         # now set ksdata back to the user's specified config
         applyDiskSelection(self.storage, self.data, self.selected_disks)
     except BootLoaderError as e:
         log.error("BootLoader setup failed: %s", e)
         StorageChecker.errors = str(e).split("\n")
         hubQ.send_message(self.__class__.__name__, _("Failed to save storage configuration..."))
         self.data.bootloader.bootDrive = ""
     else:
         if self.autopart:
             self.run()
     finally:
         resetCustomStorageData(self.data)
         self._ready = True
         hubQ.send_ready(self.__class__.__name__, True)
Ejemplo n.º 12
0
    def _subscription_progress_callback(self, phase):
        """Progress handling for subscription thread.

        Used both for both registration + attaching subscription
        and for unregistration.

        NOTE: Using the @async_action_wait decorator as this is
              called from the subscription thread. We need to do
              that as GTK does bad things if non main threads
              interact with it.
        """
        # clear error message from a previous attempt (if any)
        self.registration_error = ""
        # set registration phase
        self.registration_phase = phase

        # set spoke status according to subscription thread phase
        if phase == SubscriptionPhase.DONE:
            log.debug("Subscription GUI: registration & attach done")
            # we are done, clear the phase
            self.registration_phase = None
            # update registration and subscription parts of the spoke
            self._update_registration_state()
            self._update_subscription_state()
            # enable controls
            self.set_registration_controls_sensitive(True)
            # notify hub
            hubQ.send_ready(self.__class__.__name__)
        else:
            # processing still ongoing, set the phase
            self.registration_phase = phase
            # notify hub
            hubQ.send_ready(self.__class__.__name__)
        # update spoke state
        self._update_registration_state()
Ejemplo n.º 13
0
    def _initialize(self):
        threadMgr.wait(constants.THREAD_PAYLOAD)
        # Select groups which should be selected by kickstart
        try:
            for group in self.payload.selectedGroupsIDs():
                if self.environment and self.payload.environmentOptionIsDefault(
                        self.environment, group):
                    self._addonStates[group] = self._ADDON_DEFAULT
                else:
                    self._addonStates[group] = self._ADDON_SELECTED
        except PayloadError as e:
            # Group translation is not supported
            log.warning(e)
            # It's better to have all or nothing selected from kickstart
            self._addonStates = {}

        if not self._kickstarted:
            # having done all the slow downloading, we need to do the first refresh
            # of the UI here so there's an environment selected by default.  This
            # happens inside the main thread by necessity.  We can't do anything
            # that takes any real amount of time, or it'll block the UI from
            # updating.
            if not self._first_refresh():
                return

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

        # If packages were provided by an input kickstart file (or some other means),
        # we should do dependency solving here.
        if not self._error:
            self._apply()

        # report that software spoke initialization has been completed
        self.initialize_done()
Ejemplo n.º 14
0
    def apply(self):
        if self.root_enabled and self.password:
            # Set the root password.
            self._users_module.SetCryptedRootPassword(
                crypt_password(self.password))

            # Unlock the root account.
            self._users_module.SetRootAccountLocked(False)

        else:
            # Reset the root password.
            self._users_module.ClearRootPassword()

            # Lock the root account.
            self._users_module.SetRootAccountLocked(True)

        if self.root_enabled:
            # the checkbox makes it possible to override the default Open SSH
            # policy of not allowing root to login with password
            ssh_login_override = self._root_password_ssh_login_override.get_active(
            )
            self._users_module.SetRootPasswordSSHLoginAllowed(
                ssh_login_override)

        # clear any placeholders
        self.remove_placeholder_texts()

        # Send ready signal to main event loop
        hubQ.send_ready(self.__class__.__name__)
Ejemplo n.º 15
0
    def _wait_ready(self):
        self._add_dialog.wait_initialize()
        self._ready = True
        hubQ.send_ready(self.__class__.__name__)

        # report that the keyboard spoke initialization has been completed
        self.initialize_done()
Ejemplo n.º 16
0
    def _initialize(self):
        """Finish the initialization.

        This method is expected to run only once during the initialization.
        """
        # Wait for storage.
        hubQ.send_message(self.__class__.__name__,
                          _(constants.PAYLOAD_STATUS_PROBING_STORAGE))
        threadMgr.wait(constants.THREAD_STORAGE)

        # Automatically format DASDs if allowed.
        disks = self._disk_select_module.GetUsableDisks()
        DasdFormatting.run_automatically(disks, self._show_dasdfmt_report)
        hubQ.send_message(self.__class__.__name__,
                          _(constants.PAYLOAD_STATUS_PROBING_STORAGE))

        # Update the selected disks.
        select_default_disks()

        # Automatically apply the preconfigured partitioning.
        # Do not set ready in the automated installation before
        # the execute method is run.
        if flags.automatedInstall and self._is_preconfigured:
            self._check_required_passphrase()
            self.execute()
        else:
            self._ready = True
            hubQ.send_ready(self.__class__.__name__)

        # Report that the storage spoke has been initialized.
        self.initialize_done()
Ejemplo n.º 17
0
    def apply(self):
        # Copy data from the UI back to the kickstart object
        homedir = self._tHome.get_text()

        # If the user cleared the home directory, revert back to the
        # default
        if not homedir:
            self._user.homedir = None
        # If the user modified the home directory input, save that the
        # home directory has been modified and use the value.
        elif self._origHome != homedir:
            if not os.path.isabs(homedir):
                homedir = "/" + homedir
            self._user.homedir = homedir

        # Otherwise leave the home directory alone. If the home
        # directory is currently the default value, the next call
        # to refresh() will update the input text to reflect
        # changes in the username.

        if self._cUid.get_active():
            self._user.uid = int(self._uid.get_value())
        else:
            self._user.uid = None

        if self._cGid.get_active():
            self._user.gid = int(self._gid.get_value())
        else:
            self._user.gid = None

        # ''.split(',') returns [''] instead of [], which is not what we want
        self._user.groups = [g.strip() for g in self._tGroups.get_text().split(",") if g]

        # Send ready signal to main event loop
        hubQ.send_ready(self.__class__.__name__, False)
Ejemplo n.º 18
0
 def _doExecute(self):
     self._ready = False
     hubQ.send_not_ready(self.__class__.__name__)
     # on the off-chance dasdfmt is running, we can't proceed further
     threadMgr.wait(constants.THREAD_DASDFMT)
     hubQ.send_message(self.__class__.__name__,
                       _("Saving storage configuration..."))
     try:
         doKickstartStorage(self.storage, self.data, self.instclass)
     except (StorageError, KickstartValueError) as e:
         log.error("storage configuration failed: %s", e)
         StorageChecker.errors = str(e).split("\n")
         hubQ.send_message(self.__class__.__name__,
                           _("Failed to save storage configuration..."))
         self.data.bootloader.bootDrive = ""
         self.data.ignoredisk.drives = []
         self.data.ignoredisk.onlyuse = []
         self.storage.config.update(self.data)
         self.storage.reset()
         self.disks = getDisks(self.storage.devicetree)
         # now set ksdata back to the user's specified config
         applyDiskSelection(self.storage, self.data, self.selected_disks)
     except BootLoaderError as e:
         log.error("BootLoader setup failed: %s", e)
         StorageChecker.errors = str(e).split("\n")
         hubQ.send_message(self.__class__.__name__,
                           _("Failed to save storage configuration..."))
         self.data.bootloader.bootDrive = ""
     else:
         if self.autopart:
             self.run()
     finally:
         resetCustomStorageData(self.data)
         self._ready = True
         hubQ.send_ready(self.__class__.__name__, True)
Ejemplo n.º 19
0
    def initialize(self):
        GUIObject.initialize(self)

        self._grabObjects()

        # Validate the group input box
        self.add_check(self._tGroups, self._validateGroups)
        # Send ready signal to main event loop
        hubQ.send_ready(self.__class__.__name__, False)
Ejemplo n.º 20
0
 def builddb(self):
     oldReady = self.readyState 
     self.log.info("rocks_rolls.py:building db (builddb)")
     self.readyState = BUILDING
     hubQ.send_ready(self.__class__.__name__, False)
     self.buildit(None)
     self.readyState = oldReady
     self.log.info("rocks_rolls.py: database built (builddb)")
     hubQ.send_ready(self.__class__.__name__, True)
Ejemplo n.º 21
0
 def builddb(self):
     oldReady = self.readyState
     self.log.info("rocks_rolls.py:building db (builddb)")
     self.readyState = BUILDING
     hubQ.send_ready(self.__class__.__name__, False)
     self.buildit(None)
     self.readyState = oldReady
     self.log.info("rocks_rolls.py: database built (builddb)")
     hubQ.send_ready(self.__class__.__name__, True)
Ejemplo n.º 22
0
    def initialize(self):
        GUIObject.initialize(self)

        self._grabObjects()

        # Validate the group input box
        self.add_check(self._tGroups, self._validateGroups)
        # Send ready signal to main event loop
        hubQ.send_ready(self.__class__.__name__, False)
Ejemplo n.º 23
0
    def _initialize(self):
        hubQ.send_message(self.__class__.__name__, _("Probing storage..."))

        threadMgr.wait(constants.THREAD_STORAGE)

        hubQ.send_message(self.__class__.__name__,
                          _(METADATA_DOWNLOAD_MESSAGE))

        threadMgr.wait(constants.THREAD_PAYLOAD)

        added = False

        # If there's no fallback mirror to use, we should just disable that option
        # in the UI.
        if not self.payload.mirrorEnabled:
            self._protocolComboBox.remove(PROTOCOL_MIRROR)

        # If we've previously set up to use a CD/DVD method, the media has
        # already been mounted by payload.setup.  We can't try to mount it
        # again.  So just use what we already know to create the selector.
        # Otherwise, check to see if there's anything available.
        if self.data.method.method == "cdrom":
            self._cdrom = self.payload.install_device
        elif not flags.automatedInstall:
            self._cdrom = opticalInstallMedia(self.storage.devicetree)

        if self._cdrom:

            @gtk_action_wait
            def gtk_action_1():
                self._autodetectDeviceLabel.set_text(
                    _("Device: %s") % self._cdrom.name)
                self._autodetectLabel.set_text(
                    _("Label: %s") %
                    (getattr(self._cdrom.format, "label", "") or ""))

            gtk_action_1()
            added = True

        if self.data.method.method == "harddrive":
            self._currentIsoFile = self.payload.ISOImage

        # These UI elements default to not being showable.  If optical install
        # media were found, mark them to be shown.
        if added:
            gtk_call_once(self._autodetectBox.set_no_show_all, False)
            gtk_call_once(self._autodetectButton.set_no_show_all, False)

        # Add the mirror manager URL in as the default for HTTP and HTTPS.
        # We'll override this later in the refresh() method, if they've already
        # provided a URL.
        # FIXME

        self._reset_repoStore()

        self._ready = True
        hubQ.send_ready(self.__class__.__name__, False)
Ejemplo n.º 24
0
    def decorated(self, *args, **kwargs):
        ret = func(self, *args, **kwargs)

        self._unitialized_status = None
        self._ready = True
        # pylint: disable-msg=E1101
        hubQ.send_ready(self.__class__.__name__, True)
        hubQ.send_message(self.__class__.__name__, self.status)

        return ret
Ejemplo n.º 25
0
    def decorated(self, *args, **kwargs):
        ret = func(self, *args, **kwargs)

        self._unitialized_status = None
        self._ready = True
        # pylint: disable-msg=E1101
        hubQ.send_ready(self.__class__.__name__, True)
        hubQ.send_message(self.__class__.__name__, self.status)

        return ret
Ejemplo n.º 26
0
    def _do_execute(self):
        """Apply a non-interactive partitioning."""
        self._ready = False
        hubQ.send_not_ready(self.__class__.__name__)

        report = apply_partitioning(self._partitioning,
                                    self._show_execute_message)
        StorageCheckHandler.errors = list(report.error_messages)
        StorageCheckHandler.warnings = list(report.warning_messages)

        self._ready = True
        hubQ.send_ready(self.__class__.__name__, True)
Ejemplo n.º 27
0
    def checkStorage(self):
        threadMgr.wait(constants.THREAD_EXECUTE_STORAGE)

        hubQ.send_not_ready(self._mainSpokeClass)
        hubQ.send_message(self._mainSpokeClass, _("Checking storage configuration..."))
        (StorageChecker.errors,
         StorageChecker.warnings) = self.storage.sanityCheck()
        hubQ.send_ready(self._mainSpokeClass, True)
        for e in StorageChecker.errors:
            log.error(e)
        for w in StorageChecker.warnings:
            log.warn(w)
Ejemplo n.º 28
0
    def checkStorage(self):
        threadMgr.wait(constants.THREAD_EXECUTE_STORAGE)

        hubQ.send_not_ready(self._mainSpokeClass)
        hubQ.send_message(self._mainSpokeClass, _("Checking storage configuration..."))
        (StorageChecker.errors,
         StorageChecker.warnings) = self.storage.sanityCheck()
        hubQ.send_ready(self._mainSpokeClass, True)
        for e in StorageChecker.errors:
            self.log.error(e)
        for w in StorageChecker.warnings:
            self.log.warn(w)
Ejemplo n.º 29
0
    def _initialize(self):
        """Initialize the spoke in a separate thread."""
        threadMgr.wait(THREAD_PAYLOAD)

        # Initialize and check the software selection.
        self._initialize_selection()

        # Update the status.
        hubQ.send_ready(self.__class__.__name__)

        # Report that the software spoke has been initialized.
        self.initialize_done()
Ejemplo n.º 30
0
    def _initialize(self):
        hubQ.send_message(self.__class__.__name__, _("Probing storage..."))

        threadMgr.wait(constants.THREAD_STORAGE)

        hubQ.send_message(self.__class__.__name__, _(METADATA_DOWNLOAD_MESSAGE))

        threadMgr.wait(constants.THREAD_PAYLOAD)

        added = False

        # If there's no fallback mirror to use, we should just disable that option
        # in the UI.
        if not self.payload.mirrorEnabled:
            self._protocolComboBox.remove(PROTOCOL_MIRROR)

        # If we've previously set up to use a CD/DVD method, the media has
        # already been mounted by payload.setup.  We can't try to mount it
        # again.  So just use what we already know to create the selector.
        # Otherwise, check to see if there's anything available.
        if self.data.method.method == "cdrom":
            self._cdrom = self.payload.install_device
        elif not flags.automatedInstall:
            self._cdrom = opticalInstallMedia(self.storage.devicetree)

        if self._cdrom:
            @gtk_action_wait
            def gtk_action_1():
                self._autodetectDeviceLabel.set_text(_("Device: %s") % self._cdrom.name)
                self._autodetectLabel.set_text(_("Label: %s") % (getattr(self._cdrom.format, "label", "") or ""))

            gtk_action_1()
            added = True

        if self.data.method.method == "harddrive":
            self._currentIsoFile = self.payload.ISOImage

        # These UI elements default to not being showable.  If optical install
        # media were found, mark them to be shown.
        if added:
            gtk_call_once(self._autodetectBox.set_no_show_all, False)
            gtk_call_once(self._autodetectButton.set_no_show_all, False)

        # Add the mirror manager URL in as the default for HTTP and HTTPS.
        # We'll override this later in the refresh() method, if they've already
        # provided a URL.
        # FIXME

        self._reset_repoStore()

        self._ready = True
        hubQ.send_ready(self.__class__.__name__, False)
Ejemplo n.º 31
0
    def initialize(self):
        NormalSpoke.initialize(self)
        self.initialize_start()
        # place holders for the text boxes
        self.pw = self.builder.get_object("pw")
        self.confirm = self.builder.get_object("confirmPW")

        # Install the password checks:
        # - Has a password been specified?
        # - If a password has been specified and there is data in the confirm box, do they match?
        # - How strong is the password?
        # - Does the password contain non-ASCII characters?
        # - Is there any data in the confirm box?
        self._confirm_check = self.add_check(self.confirm,
                                             self.check_password_confirm)

        # Keep a reference for these checks, since they have to be manually run for the
        # click Done twice check.
        self._pwEmptyCheck = self.add_check(self.pw, self.check_password_empty)
        self._pwStrengthCheck = self.add_check(
            self.pw, self.check_user_password_strength)
        self._pwASCIICheck = self.add_check(self.pw, self.check_password_ASCII)

        self._kickstarted = self.data.rootpw.seen
        if self._kickstarted:
            self.pw.set_placeholder_text(_("The password is set."))
            self.confirm.set_placeholder_text(_("The password is set."))

        self.pw_bar = self.builder.get_object("password_bar")
        self.pw_label = self.builder.get_object("password_label")

        # Configure levels for the password bar
        self.pw_bar.add_offset_value("low", 2)
        self.pw_bar.add_offset_value("medium", 3)
        self.pw_bar.add_offset_value("high", 4)
        self.pw_bar.add_offset_value("full", 4)

        # Configure the password policy, if available. Otherwise use defaults.
        self.policy = self.data.anaconda.pwpolicy.get_policy("root")
        if not self.policy:
            self.policy = self.data.anaconda.PwPolicyData()

        # set the visibility of the password entries
        set_password_visibility(self.pw, False)
        set_password_visibility(self.confirm, False)

        # Send ready signal to main event loop
        hubQ.send_ready(self.__class__.__name__, False)

        # report that we are done
        self.initialize_done()
Ejemplo n.º 32
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)
Ejemplo n.º 33
0
 def _subscription_error_callback(self, error_message):
     log.debug("Subscription GUI: registration & attach failed")
     # store the error message
     self.registration_error = error_message
     # even if we fail, we are technically done,
     # so clear the phase
     self.registration_phase = None
     # update registration and subscription parts of the spoke
     self._update_registration_state()
     self._update_subscription_state()
     # re-enable controls, so user can try again
     self.set_registration_controls_sensitive(True)
     # notify hub
     hubQ.send_ready(self.__class__.__name__)
    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)
Ejemplo n.º 35
0
    def _initialize(self):
        hubQ.send_message(self.__class__.__name__, _("Probing storage..."))

        threadMgr.wait(constants.THREAD_STORAGE)
        threadMgr.wait(constants.THREAD_CUSTOM_STORAGE_INIT)

        self.disks = getDisks(self.storage.devicetree)

        # if there's only one disk, select it by default
        if len(self.disks) == 1 and not self.selected_disks:
            applyDiskSelection(self.storage, self.data, [self.disks[0].name])

        self._ready = True
        hubQ.send_ready(self.__class__.__name__, False)
Ejemplo n.º 36
0
    def _initialize(self):
        hubQ.send_message(self.__class__.__name__, _(constants.PAYLOAD_STATUS_PROBING_STORAGE))

        threadMgr.wait(constants.THREAD_STORAGE)
        threadMgr.wait(constants.THREAD_CUSTOM_STORAGE_INIT)

        self.disks = getDisks(self.storage.devicetree)

        # if there's only one disk, select it by default
        if len(self.disks) == 1 and not self.selected_disks:
            applyDiskSelection(self.storage, self.data, [self.disks[0].name])

        self._ready = True
        hubQ.send_ready(self.__class__.__name__, False)
Ejemplo n.º 37
0
 def checkSoftwareSelection(self):
     hubQ.send_message(self.__class__.__name__, _("Checking software dependencies..."))
     try:
         self.payload.check_software_selection()
     except DependencyError as e:
         self._error_msgs = str(e)
         hubQ.send_message(self.__class__.__name__, _("Error checking software dependencies"))
         self._tx_id = None
     else:
         self._error_msgs = None
         self._tx_id = self.payload.tx_id
     finally:
         hubQ.send_ready(self.__class__.__name__, False)
         hubQ.send_ready("SourceSpoke", False)
Ejemplo n.º 38
0
 def checkSoftwareSelection(self):
     hubQ.send_message(self.__class__.__name__, _("Checking software dependencies..."))
     try:
         self.payload.check_software_selection()
     except DependencyError as e:
         self._error_msgs = str(e)
         hubQ.send_message(self.__class__.__name__, _("Error checking software dependencies"))
         self._tx_id = None
     else:
         self._error_msgs = None
         self._tx_id = self.payload.tx_id
     finally:
         hubQ.send_ready(self.__class__.__name__)
         hubQ.send_ready("SourceSpoke")
Ejemplo n.º 39
0
    def initialize(self):
        NormalSpoke.initialize(self)
        self.initialize_start()
        # place holders for the text boxes
        self.pw = self.builder.get_object("pw")
        self.confirm = self.builder.get_object("confirmPW")

        # Install the password checks:
        # - Has a password been specified?
        # - If a password has been specified and there is data in the confirm box, do they match?
        # - How strong is the password?
        # - Does the password contain non-ASCII characters?
        # - Is there any data in the confirm box?
        self._confirm_check = self.add_check(self.confirm, self.check_password_confirm)

        # Keep a reference for these checks, since they have to be manually run for the
        # click Done twice check.
        self._pwEmptyCheck = self.add_check(self.pw, self.check_password_empty)
        self._pwStrengthCheck = self.add_check(self.pw, self.check_user_password_strength)
        self._pwASCIICheck = self.add_check(self.pw, self.check_password_ASCII)

        self._kickstarted = self.data.rootpw.seen
        if self._kickstarted:
            self.pw.set_placeholder_text(_("The password is set."))
            self.confirm.set_placeholder_text(_("The password is set."))

        self.pw_bar = self.builder.get_object("password_bar")
        self.pw_label = self.builder.get_object("password_label")

        # Configure levels for the password bar
        self.pw_bar.add_offset_value("low", 2)
        self.pw_bar.add_offset_value("medium", 3)
        self.pw_bar.add_offset_value("high", 4)
        self.pw_bar.add_offset_value("full", 4)

        # Configure the password policy, if available. Otherwise use defaults.
        self.policy = self.data.anaconda.pwpolicy.get_policy("root")
        if not self.policy:
            self.policy = self.data.anaconda.PwPolicyData()

        # set the visibility of the password entries
        set_password_visibility(self.pw, False)
        set_password_visibility(self.confirm, False)

        # Send ready signal to main event loop
        hubQ.send_ready(self.__class__.__name__, False)

        # report that we are done
        self.initialize_done()
Ejemplo n.º 40
0
    def checkStorage(self):
        from pyanaconda.storage_utils import storage_checker

        threadMgr.wait(constants.THREAD_EXECUTE_STORAGE)

        hubQ.send_not_ready(self._mainSpokeClass)
        hubQ.send_message(self._mainSpokeClass,
                          _("Checking storage configuration..."))

        report = storage_checker.check(self.storage)
        self.errors = report.errors
        self.warnings = report.warnings

        hubQ.send_ready(self._mainSpokeClass, True)
        report.log(self.log)
Ejemplo n.º 41
0
 def checkSoftwareSelection(self):
     from pyanaconda.packaging import DependencyError
     hubQ.send_message(self.__class__.__name__, _("Checking software dependencies..."))
     try:
         self.payload.checkSoftwareSelection()
     except DependencyError as e:
         self._errorMsgs = "\n".join(sorted(e.message))
         hubQ.send_message(self.__class__.__name__, _("Error checking software dependencies"))
         self._tx_id = None
     else:
         self._errorMsgs = None
         self._tx_id = self.payload.txID
     finally:
         hubQ.send_ready(self.__class__.__name__, False)
         hubQ.send_ready("SourceSpoke", False)
Ejemplo n.º 42
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 = None
        kickstart_timezone = self._timezone_module.proxy.Timezone
        if is_valid_timezone(kickstart_timezone):
            self._set_timezone(kickstart_timezone)
        elif not flags.flags.automatedInstall:
            log.warning(
                "%s is not a valid timezone, falling back to default (%s)",
                kickstart_timezone, DEFAULT_TZ)
            self._set_timezone(DEFAULT_TZ)
            self._timezone_module.proxy.SetTimezone(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()
Ejemplo n.º 43
0
    def checkStorage(self):
        from pyanaconda.storage_utils import storage_checker

        threadMgr.wait(constants.THREAD_EXECUTE_STORAGE)

        hubQ.send_not_ready(self._mainSpokeClass)
        hubQ.send_message(self._mainSpokeClass, _("Checking storage configuration..."))

        report = storage_checker.check(self.storage)
        # Storage spoke and custom spoke communicate errors via StorageCheckHandler,
        # so we need to set errors and warnings class attributes here.
        StorageCheckHandler.errors = report.errors
        StorageCheckHandler.warnings = report.warnings

        hubQ.send_ready(self._mainSpokeClass, True)
        report.log(self.log)
Ejemplo n.º 44
0
    def checkStorage(self):
        from pyanaconda.storage_utils import sanity_check, SanityError, SanityWarning

        threadMgr.wait(constants.THREAD_EXECUTE_STORAGE)

        hubQ.send_not_ready(self._mainSpokeClass)
        hubQ.send_message(self._mainSpokeClass, _("Checking storage configuration..."))
        exns = sanity_check(self.storage, min_ram=self._min_ram)
        errors = [str(exn) for exn in exns if isinstance(exn, SanityError)]
        warnings = [str(exn) for exn in exns if isinstance(exn, SanityWarning)]
        (StorageChecker.errors, StorageChecker.warnings) = (errors, warnings)
        hubQ.send_ready(self._mainSpokeClass, True)
        for e in StorageChecker.errors:
            self.log.error(e)
        for w in StorageChecker.warnings:
            self.log.warning(w)
Ejemplo n.º 45
0
    def _initialize(self):
        threadMgr.wait(constants.THREAD_PAYLOAD)
        if not self._kickstarted:
            # having done all the slow downloading, we need to do the first refresh
            # of the UI here so there's an environment selected by default.  This
            # happens inside the main thread by necessity.  We can't do anything
            # that takes any real amount of time, or it'll block the UI from
            # updating.
            if not self._first_refresh():
                return

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

        # If packages were provided by an input kickstart file (or some other means),
        # we should do dependency solving here.
        if not self._error:
            self._apply()
Ejemplo n.º 46
0
    def _initialize(self):
        # wait for subscription thread to finish (if any)
        threadMgr.wait(THREAD_SUBSCRIPTION)
        # also wait for the payload thread, which migh still be processing
        # a CDROM source, to avoid the Subscription being mandatory by mistake
        # due to CDN still being default at the time of evaulation
        threadMgr.wait(THREAD_PAYLOAD)

        # update overall state
        self._update_registration_state()
        self._update_subscription_state()

        # Send ready signal to main event loop
        hubQ.send_ready(self.__class__.__name__)

        # report that we are done
        self.initialize_done()
Ejemplo n.º 47
0
    def checkStorage(self):
        from pyanaconda.storage_utils import storage_checker

        threadMgr.wait(constants.THREAD_EXECUTE_STORAGE)

        hubQ.send_not_ready(self._mainSpokeClass)
        hubQ.send_message(self._mainSpokeClass,
                          _("Checking storage configuration..."))

        report = storage_checker.check(self.storage)
        # Storage spoke and custom spoke communicate errors via StorageCheckHandler,
        # so we need to set errors and warnings class attributes here.
        StorageCheckHandler.errors = report.errors
        StorageCheckHandler.warnings = report.warnings

        hubQ.send_ready(self._mainSpokeClass, True)
        report.log(self.log)
Ejemplo n.º 48
0
    def checkStorage(self):
        from blivet.errors import SanityError
        from blivet.errors import SanityWarning

        threadMgr.wait(constants.THREAD_EXECUTE_STORAGE)

        hubQ.send_not_ready(self._mainSpokeClass)
        hubQ.send_message(self._mainSpokeClass, _("Checking storage configuration..."))
        exns = self.storage.sanityCheck()
        errors = [exn.message for exn in exns if isinstance(exn, SanityError)]
        warnings = [exn.message for exn in exns if isinstance(exn, SanityWarning)]
        (StorageChecker.errors, StorageChecker.warnings) = (errors, warnings)
        hubQ.send_ready(self._mainSpokeClass, True)
        for e in StorageChecker.errors:
            self.log.error(e)
        for w in StorageChecker.warnings:
            self.log.warning(w)
Ejemplo n.º 49
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 = None
        kickstart_timezone = self._timezone_module.proxy.Timezone
        if is_valid_timezone(kickstart_timezone):
            self._set_timezone(kickstart_timezone)
        elif not flags.flags.automatedInstall:
            log.warning("%s is not a valid timezone, falling back to default (%s)",
                        kickstart_timezone, DEFAULT_TZ)
            self._set_timezone(DEFAULT_TZ)
            self._timezone_module.proxy.SetTimezone(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()
Ejemplo n.º 50
0
    def _initialize(self):
        hubQ.send_message(self.__class__.__name__, _("Downloading package metadata..."))

        threadMgr.wait(constants.THREAD_PAYLOAD)

        hubQ.send_message(self.__class__.__name__, _("Downloading group metadata..."))

        # we have no way to select environments with kickstart right now
        # so don't try.
        if flags.automatedInstall and self.data.packages.seen:
            # We don't want to do a full refresh, just join the metadata thread
            threadMgr.wait(constants.THREAD_PAYLOAD_MD)
        else:
            # Grabbing the list of groups could potentially take a long time
            # at first (yum does a lot of magic property stuff, some of which
            # involves side effects like network access.  We need to reference
            # them here, outside of the main thread, to not block the UI.
            try:
                # pylint: disable-msg=W0104
                self.payload.environments
                # pylint: disable-msg=W0104
                self.payload.groups

                # Parse the environments and groups into the form we want
                self._parseEnvironments()
            except MetadataError:
                hubQ.send_message(self.__class__.__name__,
                                  _("No installation source available"))
                return

            # And then having done all that slow downloading, we need to do the first
            # refresh of the UI here so there's an environment selected by default.
            # This happens inside the main thread by necessity.  We can't do anything
            # that takes any real amount of time, or it'll block the UI from updating.
            if not self._first_refresh():
                return

        self.payload.release()

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

        # If packages were provided by an input kickstart file (or some other means),
        # we should do dependency solving here.
        self._apply()
Ejemplo n.º 51
0
    def ready(self):
        """
        The ready property that tells whether the spoke is ready (can be visited)
        or not. The spoke is made (in)sensitive based on the returned value.

        :rtype: bool

        """
        self.derivedValues()
        # Check if the hostname starts with "localhost"
        # if
        if self.privateHostname.startswith("localhost"):
            self.readyState=BADHOSTNAME
            return False
        # if the readyState was BADHOSTNAME return to CONFIGURE state
        if self.readyState == BADHOSTNAME:
            self.readyState = CONFIGURE
            hubQ.send_ready(self.__class__.__name__, True)

        self.log.info("rocks_private.py:ready")
        return True
Ejemplo n.º 52
0
 def _doExecute(self):
     self._ready = False
     hubQ.send_not_ready(self.__class__.__name__)
     # on the off-chance dasdfmt is running, we can't proceed further
     threadMgr.wait(constants.THREAD_DASDFMT)
     hubQ.send_message(self.__class__.__name__, _("Saving storage configuration..."))
     if flags.automatedInstall and self.data.autopart.encrypted and not self.data.autopart.passphrase:
         self.autopart_missing_passphrase = True
         StorageChecker.errors = [_("Passphrase for autopart encryption not specified.")]
         self._ready = True
         hubQ.send_ready(self.__class__.__name__, True)
         return
     try:
         doKickstartStorage(self.storage, self.data, self.instclass)
     except (StorageError, KickstartParseError) as e:
         log.error("storage configuration failed: %s", e)
         StorageChecker.errors = str(e).split("\n")
         hubQ.send_message(self.__class__.__name__, _("Failed to save storage configuration..."))
         self.data.bootloader.bootDrive = ""
         self.data.ignoredisk.drives = []
         self.data.ignoredisk.onlyuse = []
         self.storage.config.update(self.data)
         self.storage.reset()
         self.disks = getDisks(self.storage.devicetree)
         # now set ksdata back to the user's specified config
         applyDiskSelection(self.storage, self.data, self.selected_disks)
     except BootLoaderError as e:
         log.error("BootLoader setup failed: %s", e)
         StorageChecker.errors = str(e).split("\n")
         hubQ.send_message(self.__class__.__name__, _("Failed to save storage configuration..."))
         self.data.bootloader.bootDrive = ""
     else:
         if self.autopart or (flags.automatedInstall and (self.data.autopart.autopart or self.data.partition.seen)):
             # run() executes StorageChecker.checkStorage in a seperate threat
             self.run()
     finally:
         resetCustomStorageData(self.data)
         self._ready = True
         hubQ.send_ready(self.__class__.__name__, True)
Ejemplo n.º 53
0
    def apply(self):
        pw = self.pw.get_text()

        # value from the kickstart changed
        self.data.rootpw.seen = False
        self._kickstarted = False

        self.data.rootpw.lock = False

        if not pw:
            self.data.rootpw.password = ''
            self.data.rootpw.isCrypted = False
            return

        self.data.rootpw.password = cryptPassword(pw)
        self.data.rootpw.isCrypted = True

        self.pw.set_placeholder_text("")
        self.confirm.set_placeholder_text("")

        # Send ready signal to main event loop
        hubQ.send_ready(self.__class__.__name__, False)
Ejemplo n.º 54
0
    def apply(self):
        pw = self.password

        # value from the kickstart changed
        # NOTE: yet again, this stops to be valid once multiple
        #       commands are supported by a single DBUS module
        self._users_module.proxy.SetRootpwKickstarted(False)
        self.password_kickstarted = False

        self._users_module.proxy.SetRootAccountLocked(False)

        if not pw:
            self._users_module.proxy.ClearRootPassword()
            return

        # we have a password - set it to kickstart data

        self._users_module.proxy.SetCryptedRootPassword(cryptPassword(pw))

        # clear any placeholders
        self.remove_placeholder_texts()

        # Send ready signal to main event loop
        hubQ.send_ready(self.__class__.__name__, False)
Ejemplo n.º 55
0
 def getRepoMetadata(self):
     hubQ.send_not_ready("SoftwareSelectionSpoke")
     hubQ.send_not_ready(self.__class__.__name__)
     hubQ.send_message(self.__class__.__name__, _(BASEREPO_SETUP_MESSAGE))
     # this sleep is lame, but without it the message above doesn't seem
     # to get processed by the hub in time, and is never shown.
     # FIXME this should get removed when we figure out how to ensure
     # that the message takes effect on the hub before we try to mount
     # a bad NFS server.
     time.sleep(1)
     try:
         self.payload.updateBaseRepo(fallback=False, checkmount=False)
     except (OSError, PayloadError) as e:
         log.error("PayloadError: %s", e)
         self._error = True
         hubQ.send_message(self.__class__.__name__, _("Failed to set up installation source"))
         if not (hasattr(self.data.method, "proxy") and self.data.method.proxy):
             gtk_call_once(self.set_warning, _("Failed to set up installation source; check the repo url"))
         else:
             gtk_call_once(self.set_warning, _("Failed to set up installation source; check the repo url and proxy settings"))
     else:
         self._error = False
         hubQ.send_message(self.__class__.__name__, _(METADATA_DOWNLOAD_MESSAGE))
         self.payload.gatherRepoMetadata()
         self.payload.release()
         if not self.payload.baseRepo:
             hubQ.send_message(self.__class__.__name__, _(METADATA_ERROR_MESSAGE))
             hubQ.send_ready(self.__class__.__name__, False)
             self._error = True
             gtk_call_once(self.set_warning, _("Failed to set up installation source; check the repo url"))
         else:
             try:
                 # Grabbing the list of groups could potentially take a long time the
                 # first time (yum does a lot of magic property stuff, some of which
                 # involves side effects like network access) so go ahead and grab
                 # them now. These are properties with side-effects, just accessing
                 # them will trigger yum.
                 # pylint: disable-msg=W0104
                 self.payload.environments
                 # pylint: disable-msg=W0104
                 self.payload.groups
             except MetadataError:
                 hubQ.send_message("SoftwareSelectionSpoke",
                                   _("No installation source available"))
             else:
                 hubQ.send_ready("SoftwareSelectionSpoke", False)
     finally:
         hubQ.send_ready(self.__class__.__name__, False)
Ejemplo n.º 56
0
    def initialize(self):
        NormalSpoke.initialize(self)
        self.initialize_start()
        # get object references from the builders
        self._password_entry = self.builder.get_object("password_entry")
        self._password_confirmation_entry = self.builder.get_object("password_confirmation_entry")
        self._password_bar = self.builder.get_object("password_bar")
        self._password_label = self.builder.get_object("password_label")

        # set state based on kickstart
        # NOTE: this will stop working once the module supports multiple kickstart commands
        self.password_kickstarted = self._users_module.proxy.IsRootpwKickstarted

        # Install the password checks:
        # - Has a password been specified?
        # - If a password has been specified and there is data in the confirm box, do they match?
        # - How strong is the password?
        # - Does the password contain non-ASCII characters?

        # Setup the password checker for password checking
        self._checker = input_checking.PasswordChecker(
                initial_password_content = self.password,
                initial_password_confirmation_content = self.password_confirmation,
                policy = input_checking.get_policy(self.data, "root")
        )
        # configure the checker for password checking
        self.checker.secret_type = constants.SecretType.PASSWORD
        # remove any placeholder texts if either password or confirmation field changes content from initial state
        self.checker.password.changed_from_initial_state.connect(self.remove_placeholder_texts)
        self.checker.password_confirmation.changed_from_initial_state.connect(self.remove_placeholder_texts)
        # connect UI updates to check results
        self.checker.checks_done.connect(self._checks_done)

        # check that the password is not empty
        self._empty_check = input_checking.PasswordEmptyCheck()
        # check that the content of the password field & the conformation field are the same
        self._confirm_check = input_checking.PasswordConfirmationCheck()
        # regards both fields empty as success to let the user escape
        self._confirm_check.success_if_confirmation_empty = True
        # check password validity, quality and strength
        self._validity_check = input_checking.PasswordValidityCheck()
        # connect UI updates to validity check results
        self._validity_check.result.password_score_changed.connect(self.set_password_score)
        self._validity_check.result.status_text_changed.connect(self.set_password_status)
        # check if the password contains non-ascii characters
        self._ascii_check = input_checking.PasswordASCIICheck()

        # register the individual checks with the checker in proper order
        # 1) is the password non-empty ?
        # 2) are both entered passwords the same ?
        # 3) is the password valid according to the current password checking policy ?
        # 4) is the password free of non-ASCII characters ?
        self.checker.add_check(self._empty_check)
        self.checker.add_check(self._confirm_check)
        self.checker.add_check(self._validity_check)
        self.checker.add_check(self._ascii_check)

        # set placeholders if the password has been kickstarted as we likely don't know
        # nothing about it and can't really show it in the UI in any meaningful way
        password_set_message = _("The password was set by kickstart.")
        if self.password_kickstarted:
            self.password_entry.set_placeholder_text(password_set_message)
            self.password_confirmation_entry.set_placeholder_text(password_set_message)

        # Configure levels for the password bar
        self._password_bar.add_offset_value("low", 2)
        self._password_bar.add_offset_value("medium", 3)
        self._password_bar.add_offset_value("high", 4)

        # Send ready signal to main event loop
        hubQ.send_ready(self.__class__.__name__, False)

        # report that we are done
        self.initialize_done()
Ejemplo n.º 57
0
    def initialize(self):
        """
        The initialize method that is called after the instance is created.
        The difference between __init__ and this method is that this may take
        a long time and thus could be called in a separated thread.

        :see: pyanaconda.ui.common.UIObject.initialize

        """

        NormalSpoke.initialize(self)
        column = self.builder.get_object("messageTypeColumn")
        renderer = self.builder.get_object("messageTypeRenderer")
        column.set_cell_data_func(renderer, render_message_type)

        # the main notebook containing two pages -- for settings parameters and
        # for entering content URL
        self._main_notebook = self.builder.get_object("mainNotebook")

        # the store that holds the messages that come from the rules evaluation
        self._message_store = self.builder.get_object("changesStore")

        # stores with data streams, checklists and profiles
        self._ds_store = self.builder.get_object("dsStore")
        self._xccdf_store = self.builder.get_object("xccdfStore")
        self._profiles_store = self.builder.get_object("profilesStore")

        # comboboxes for data streams and checklists
        self._ids_box = self.builder.get_object("idsBox")
        self._ds_combo = self.builder.get_object("dsCombo")
        self._xccdf_combo = self.builder.get_object("xccdfCombo")

        # profiles view and selection
        self._profiles_view = self.builder.get_object("profilesView")
        self._profiles_selection = self.builder.get_object("profilesSelection")
        selected_column = self.builder.get_object("selectedColumn")
        selected_renderer = self.builder.get_object("selectedRenderer")
        selected_column.set_cell_data_func(selected_renderer,
                                           self._render_selected)

        # button for switching profiles
        self._choose_button = self.builder.get_object("chooseProfileButton")

        # toggle switching the dry-run mode
        self._dry_run_switch = self.builder.get_object("dryRunSwitch")

        # control buttons
        self._control_buttons = self.builder.get_object("controlButtons")

        # content URL entering, content fetching, ...
        self._no_content_label = self.builder.get_object("noContentLabel")
        self._content_url_entry = self.builder.get_object("urlEntry")
        self._fetch_button = self.builder.get_object("fetchButton")
        self._progress_box = self.builder.get_object("progressBox")
        self._progress_spinner = self.builder.get_object("progressSpinner")
        self._progress_label = self.builder.get_object("progressLabel")
        self._ssg_button = self.builder.get_object("ssgButton")

        # if no content was specified and SSG is available, use it
        if not self._addon_data.content_type and common.ssg_available():
            self._addon_data.content_type = "scap-security-guide"
            self._addon_data.content_path = common.SSG_DIR + common.SSG_CONTENT

        if not self._addon_data.content_defined:
            # nothing more to be done now, the spoke is ready
            self._ready = True

            # no more being unitialized
            self._unitialized_status = None

            # user is going to enter the content URL
            self._content_url_entry.grab_focus()

            # pylint: disable-msg=E1101
            hubQ.send_ready(self.__class__.__name__, True)
        else:
            # else fetch data
            self._fetch_data_and_initialize()
Ejemplo n.º 58
0
 def _wait_ready(self):
     self._add_dialog.wait_initialize()
     self._ready = True
     hubQ.send_ready(self.__class__.__name__, False)