Ejemplo n.º 1
0
    def _apply(self):
        if not self.environment:
            return

        # NOTE: This block is skipped for kickstart where addons and _origAddons will
        # both be [], preventing it from wiping out the kickstart's package selection
        addons = self._get_selected_addons()
        if set(addons) != set(self._origAddons):
            for group in addons:
                if group not in self.selectedGroups:
                    self.selectedGroups.append(group)

            self._selectFlag = False
            self.payload.data.packages.packageList = []
            self.payload.data.packages.groupList = []
            self.payload.selectEnvironment(self.environment)
            for group in self.selectedGroups:
                self.payload.selectGroup(group)

            # And then save these values so we can check next time.
            self._origAddons = addons
            self._origEnvironment = self.environment

        hubQ.send_not_ready(self.__class__.__name__)
        hubQ.send_not_ready("SourceSpoke")
        threadMgr.add(
            AnacondaThread(name=constants.THREAD_CHECK_SOFTWARE,
                           target=self.checkSoftwareSelection))
Ejemplo n.º 2
0
    def _apply(self):
        env = self._get_selected_environment()

        # Check if a kickstart install still looks like a kickstart install
        # If an environment is selected and either the environment or the
        # addon list does not match the ksdata, the packages were
        # selected interactively.
        if env and self._kickstarted:
            if env != self.data.packages.environment or \
                    set(self.selectedGroups) != set(self.data.packages.groupList):
                self._kickstarted = False

        # Not a kickstart with packages, setup the environment and groups
        if env and not self._kickstarted:
            addons = self._get_selected_addons()
            for group in addons:
                if group not in self.selectedGroups:
                    self.selectedGroups.append(group)

            self._selectFlag = False
            self.payload.data.packages.packageList = []
            self.payload.data.packages.groupList = []
            self.payload.selectEnvironment(env)
            self.environment = env
            for group in self.selectedGroups:
                self.payload.selectGroup(group)

            # And then save these values so we can check next time.
            self._origAddons = addons
            self._origEnvironment = self.environment

        hubQ.send_not_ready(self.__class__.__name__)
        hubQ.send_not_ready("SourceSpoke")
        threadMgr.add(AnacondaThread(name=constants.THREAD_CHECK_SOFTWARE,
                                     target=self.checkSoftwareSelection))
Ejemplo n.º 3
0
    def _apply(self):
        # Environment needs to be set during a GUI installation, but is not required
        # for a kickstart install (even partial)
        if not self.environment:
            log.debug("Environment is not set, skip user packages settings")
            return

        # NOTE: This block is skipped for kickstart where addons and _origAddons will
        # both be [], preventing it from wiping out the kickstart's package selection
        addons = self._get_selected_addons()
        if not self._kickstarted and set(addons) != set(self._origAddons):
            self._selectFlag = False
            self.payload.data.packages.packageList = []
            self.payload.data.packages.groupList = []
            self.payload.selectEnvironment(self.environment)
            log.debug("Environment selected for installation: %s", self.environment)
            log.debug("Groups selected for installation: %s", addons)
            for group in addons:
                self.payload.selectGroup(group)

            # And then save these values so we can check next time.
            self._origAddons = addons
            self._origEnvironment = self.environment

        hubQ.send_not_ready(self.__class__.__name__)
        hubQ.send_not_ready("SourceSpoke")
        threadMgr.add(AnacondaThread(name=constants.THREAD_CHECK_SOFTWARE,
                                     target=self.checkSoftwareSelection))
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 _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.º 6
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.º 7
0
    def _fetch_data_and_initialize(self):
        """Fetch data from a specified URL and initialize everything."""

        with self._fetch_flag_lock:
            if self._fetching:
                # prevent multiple fetches running simultaneously
                return
            self._fetching = True

        thread_name = None
        if any(self._addon_data.content_url.startswith(net_prefix)
               for net_prefix in data_fetch.NET_URL_PREFIXES):
            # need to fetch data over network
            thread_name = common.wait_and_fetch_net_data(
                                     self._addon_data.content_url,
                                     self._addon_data.raw_preinst_content_path,
                                     self._addon_data.certificates)

        # pylint: disable-msg=E1101
        hubQ.send_message(self.__class__.__name__,
                          _("Fetching content data"))
        # pylint: disable-msg=E1101
        hubQ.send_not_ready(self.__class__.__name__)
        threadMgr.add(AnacondaThread(name="OSCAPguiWaitForDataFetchThread",
                                     target=self._init_after_data_fetch,
                                     args=(thread_name,)))
Ejemplo n.º 8
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.º 9
0
    def _apply(self):
        env = self._get_selected_environment()
        if not env:
            return

        addons = self._get_selected_addons()
        for group in addons:
            if group not in self.selectedGroups:
                self.selectedGroups.append(group)

        self._selectFlag = False
        self.payload.data.packages.groupList = []
        self.payload.selectEnvironment(env)
        self.environment = env
        for group in self.selectedGroups:
            self.payload.selectGroup(group)

        # And then save these values so we can check next time.
        self._origAddons = addons
        self._origEnvironment = self.environment

        hubQ.send_not_ready(self.__class__.__name__)
        hubQ.send_not_ready("SourceSpoke")
        threadMgr.add(AnacondaThread(name=constants.THREAD_CHECK_SOFTWARE,
                                     target=self.checkSoftwareSelection))
Ejemplo n.º 10
0
    def _apply(self):
        if not self.environment:
            return

        # NOTE: This block is skipped for kickstart where addons and _origAddons will
        # both be [], preventing it from wiping out the kickstart's package selection
        addons = self._get_selected_addons()
        if set(addons) != set(self._origAddons):
            for group in addons:
                if group not in self.selectedGroups:
                    self.selectedGroups.append(group)

            self._selectFlag = False
            self.payload.data.packages.packageList = []
            self.payload.data.packages.groupList = []
            self.payload.selectEnvironment(self.environment)
            for group in self.selectedGroups:
                self.payload.selectGroup(group)

            # And then save these values so we can check next time.
            self._origAddons = addons
            self._origEnvironment = self.environment

        hubQ.send_not_ready(self.__class__.__name__)
        hubQ.send_not_ready("SourceSpoke")
        threadMgr.add(AnacondaThread(name=constants.THREAD_CHECK_SOFTWARE,
                                     target=self.checkSoftwareSelection))
Ejemplo n.º 11
0
    def _apply(self):
        # Environment needs to be set during a GUI installation, but is not required
        # for a kickstart install (even partial)
        if not self.environment:
            log.debug("Environment is not set, skip user packages settings")
            return

        # NOTE: This block is skipped for kickstart where addons and _origAddons will
        # both be [], preventing it from wiping out the kickstart's package selection
        addons = self._get_selected_addons()
        if not self._kickstarted and set(addons) != set(self._origAddons):
            self._selectFlag = False
            self.payload.data.packages.packageList = []
            self.payload.data.packages.groupList = []
            self.payload.selectEnvironment(self.environment)
            log.debug("Environment selected for installation: %s",
                      self.environment)
            log.debug("Groups selected for installation: %s", addons)
            for group in addons:
                self.payload.selectGroup(group)

            # And then save these values so we can check next time.
            self._origAddons = addons
            self._origEnvironment = self.environment

        hubQ.send_not_ready(self.__class__.__name__)
        hubQ.send_not_ready("SourceSpoke")
        threadMgr.add(
            AnacondaThread(name=constants.THREAD_CHECK_SOFTWARE,
                           target=self.checkSoftwareSelection))
Ejemplo n.º 12
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.
                 e = self.payload.environments
                 g = 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.º 13
0
    def initialize(self):
        super().initialize()
        self.initialize_start()


        # set X keyboard defaults
        # - this needs to be done early in spoke initialization so that
        #   the spoke status does not show outdated keyboard selection
        keyboard.set_x_keyboard_defaults(self._l12_module, self._xkl_wrapper)

        # make sure the x_layouts list has at least one keyboard layout
        if not self._l12_module.XLayouts:
            self._l12_module.SetXLayouts([DEFAULT_KEYBOARD])

        self._add_dialog = AddLayoutDialog(self.data)
        self._add_dialog.initialize()

        if conf.system.can_configure_keyboard:
            self.builder.get_object("warningBox").hide()

        # We want to store layouts' names but show layouts as
        # 'language (description)'.
        layoutColumn = self.builder.get_object("layoutColumn")
        layoutRenderer = self.builder.get_object("layoutRenderer")
        override_cell_property(layoutColumn, layoutRenderer, "text", _show_layout,
                                            self._xkl_wrapper)

        self._store = self.builder.get_object("addedLayoutStore")
        self._add_data_layouts()

        self._selection = self.builder.get_object("layoutSelection")

        self._switching_dialog = ConfigureSwitchingDialog(self.data, self._l12_module)
        self._switching_dialog.initialize()

        self._layoutSwitchLabel = self.builder.get_object("layoutSwitchLabel")

        if not conf.system.can_configure_keyboard:
            # Disable area for testing layouts as we cannot make
            # it work without modifying runtime system

            widgets = [self.builder.get_object("testingLabel"),
                       self.builder.get_object("testingWindow"),
                       self.builder.get_object("layoutSwitchLabel")]

            # Use testingLabel's text to explain why this part is not
            # sensitive.
            widgets[0].set_text(_("Testing layouts configuration not "
                                  "available."))

            for widget in widgets:
                widget.set_sensitive(False)

        hubQ.send_not_ready(self.__class__.__name__)
        hubQ.send_message(self.__class__.__name__,
                          _("Getting list of layouts..."))
        threadMgr.add(AnacondaThread(name=THREAD_KEYBOARD_INIT,
                                     target=self._wait_ready))
Ejemplo n.º 14
0
    def initialize(self):
        NormalSpoke.initialize(self)
        self.initialize_start()

        # set X keyboard defaults
        # - this needs to be done early in spoke initialization so that
        #   the spoke status does not show outdated keyboard selection
        keyboard.set_x_keyboard_defaults(self.data, self._xkl_wrapper)

        # make sure the x_layouts list has at least one keyboard layout
        if not self.data.keyboard.x_layouts:
            self.data.keyboard.x_layouts.append(DEFAULT_KEYBOARD)

        self._add_dialog = AddLayoutDialog(self.data)
        self._add_dialog.initialize()

        if flags.can_touch_runtime_system("hide runtime keyboard configuration "
                                          "warning", touch_live=True):
            self.builder.get_object("warningBox").hide()

        # We want to store layouts' names but show layouts as
        # 'language (description)'.
        layoutColumn = self.builder.get_object("layoutColumn")
        layoutRenderer = self.builder.get_object("layoutRenderer")
        override_cell_property(layoutColumn, layoutRenderer, "text", _show_layout,
                                            self._xkl_wrapper)

        self._store = self.builder.get_object("addedLayoutStore")
        self._add_data_layouts()

        self._selection = self.builder.get_object("layoutSelection")

        self._switching_dialog = ConfigureSwitchingDialog(self.data)
        self._switching_dialog.initialize()

        self._layoutSwitchLabel = self.builder.get_object("layoutSwitchLabel")

        if not flags.can_touch_runtime_system("test X layouts", touch_live=True):
            # Disable area for testing layouts as we cannot make
            # it work without modifying runtime system

            widgets = [self.builder.get_object("testingLabel"),
                       self.builder.get_object("testingWindow"),
                       self.builder.get_object("layoutSwitchLabel")]

            # Use testingLabel's text to explain why this part is not
            # sensitive.
            widgets[0].set_text(_("Testing layouts configuration not "
                                  "available."))

            for widget in widgets:
                widget.set_sensitive(False)

        hubQ.send_not_ready(self.__class__.__name__)
        hubQ.send_message(self.__class__.__name__,
                          _("Getting list of layouts..."))
        threadMgr.add(AnacondaThread(name=THREAD_KEYBOARD_INIT,
                                     target=self._wait_ready))
Ejemplo n.º 15
0
    def apply(self):
        """Apply the changes."""
        self._kickstarted = False

        selection = self._selection_cache.get_selection_data()
        log.debug("Setting new software selection: %s", selection)

        self.payload.set_packages_selection(selection)

        hubQ.send_not_ready(self.__class__.__name__)
        hubQ.send_not_ready("SourceSpoke")
Ejemplo n.º 16
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.º 17
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.º 18
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.º 19
0
    def initialize(self):
        NormalSpoke.initialize(self)
        self._add_dialog = AddLayoutDialog(self.data)
        self._add_dialog.initialize()

        if flags.can_touch_runtime_system(
                "hide runtime keyboard configuration "
                "warning", touch_live=True):
            self.builder.get_object("warningBox").hide()

        # We want to store layouts' names but show layouts as
        # 'language (description)'.
        layoutColumn = self.builder.get_object("layoutColumn")
        layoutRenderer = self.builder.get_object("layoutRenderer")
        override_cell_property(layoutColumn, layoutRenderer, "text",
                               _show_layout, self._xkl_wrapper)

        self._store = self.builder.get_object("addedLayoutStore")
        self._add_data_layouts()

        self._selection = self.builder.get_object("layoutSelection")

        self._switching_dialog = ConfigureSwitchingDialog(self.data)
        self._switching_dialog.initialize()

        self._layoutSwitchLabel = self.builder.get_object("layoutSwitchLabel")

        if not flags.can_touch_runtime_system("test X layouts",
                                              touch_live=True):
            # Disable area for testing layouts as we cannot make
            # it work without modifying runtime system

            widgets = [
                self.builder.get_object("testingLabel"),
                self.builder.get_object("testingWindow"),
                self.builder.get_object("layoutSwitchLabel")
            ]

            # Use testingLabel's text to explain why this part is not
            # sensitive.
            widgets[0].set_text(
                _("Testing layouts configuration not "
                  "available."))

            for widget in widgets:
                widget.set_sensitive(False)

        hubQ.send_not_ready(self.__class__.__name__)
        hubQ.send_message(self.__class__.__name__,
                          _("Getting list of layouts..."))
        threadMgr.add(
            AnacondaThread(name=THREAD_KEYBOARD_INIT, target=self._wait_ready))
Ejemplo n.º 20
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.º 21
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.º 22
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.º 23
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.º 24
0
    def initialize(self):
        NormalSpoke.initialize(self)
        self._add_dialog = AddLayoutDialog(self.data)
        self._add_dialog.initialize()

        if flags.can_touch_runtime_system("hide runtime keyboard configuration "
                                          "warning", touch_live=True):
            self.builder.get_object("warningBox").hide()

        # We want to store layouts' names but show layouts as
        # 'language (description)'.
        layoutColumn = self.builder.get_object("layoutColumn")
        layoutRenderer = self.builder.get_object("layoutRenderer")
        layoutColumn.set_cell_data_func(layoutRenderer, _show_layout,
                                            self._xkl_wrapper)

        self._store = self.builder.get_object("addedLayoutStore")
        self._add_data_layouts()

        self._selection = self.builder.get_object("layoutSelection")

        self._switching_dialog = ConfigureSwitchingDialog(self.data)
        self._switching_dialog.initialize()

        self._layoutSwitchLabel = self.builder.get_object("layoutSwitchLabel")

        if not flags.can_touch_runtime_system("test X layouts", touch_live=True):
            # Disable area for testing layouts as we cannot make
            # it work without modifying runtime system

            widgets = [self.builder.get_object("testingLabel"),
                       self.builder.get_object("testingWindow"),
                       self.builder.get_object("layoutSwitchLabel")]

            # Use testingLabel's text to explain why this part is not
            # sensitive.
            widgets[0].set_text(_("Testing layouts configuration not "
                                  "available."))

            for widget in widgets:
                widget.set_sensitive(False)

        hubQ.send_not_ready(self.__class__.__name__)
        hubQ.send_message(self.__class__.__name__,
                          _("Getting list of layouts..."))
        threadMgr.add(AnacondaThread(name=THREAD_KEYBOARD_INIT,
                                     target=self._wait_ready))
Ejemplo n.º 25
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.º 26
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.º 27
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.º 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..."))
        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:
            log.error(e)
        for w in StorageChecker.warnings:
            log.warning(w)
Ejemplo n.º 29
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.º 30
0
    def _fetch_data_and_initialize(self):
        """Fetch data from a specified URL and initialize everything."""

        with self._fetch_flag_lock:
            if self._fetching:
                # prevent multiple fetches running simultaneously
                return
            self._fetching = True

        thread_name = None
        if self._policy_data.content_url and self._policy_data.content_type != "scap-security-guide":
            log.info(f"OSCAP Addon: Actually fetching content from somewhere")
            thread_name = self.content_bringer.fetch_content(
                self._handle_error, self._policy_data.certificates)

        # pylint: disable-msg=E1101
        hubQ.send_message(self.__class__.__name__,
                          _("Fetching content data"))
        # pylint: disable-msg=E1101
        hubQ.send_not_ready(self.__class__.__name__)
        threadMgr.add(AnacondaThread(name="OSCAPguiWaitForDataFetchThread",
                                     target=self._init_after_data_fetch,
                                     args=(thread_name,)))
Ejemplo n.º 31
0
    def apply(self):
        """Apply the changes."""
        self._kickstarted = False

        # Clear packages data.
        self._selection.packages = []
        self._selection.excluded_packages = []

        # Clear groups data.
        self._selection.excluded_groups = []
        self._selection.groups_package_types = {}

        # Select new groups.
        self._selection.groups = []

        for group_name in self._get_selected_addons():
            self._selection.groups.append(group_name)

        log.debug("Setting new software selection: %s", self._selection)
        self.payload.set_packages_data(self._selection)

        hubQ.send_not_ready(self.__class__.__name__)
        hubQ.send_not_ready("SourceSpoke")
Ejemplo n.º 32
0
    def _apply(self):
        env = self._get_selected_environment()

        # Check if a kickstart install still looks like a kickstart install
        # If an environment is selected and either the environment or the
        # addon list does not match the ksdata, the packages were
        # selected interactively.
        if env and self._kickstarted:
            if env != self.data.packages.environment or \
                    set(self.selectedGroups) != set(self.data.packages.groupList):
                self._kickstarted = False

        # Not a kickstart with packages, setup the environment and groups
        if env and not self._kickstarted:
            addons = self._get_selected_addons()
            for group in addons:
                if group not in self.selectedGroups:
                    self.selectedGroups.append(group)

            self._selectFlag = False
            self.payload.data.packages.packageList = []
            self.payload.data.packages.groupList = []
            self.payload.selectEnvironment(env)
            self.environment = env
            for group in self.selectedGroups:
                self.payload.selectGroup(group)

            # And then save these values so we can check next time.
            self._origAddons = addons
            self._origEnvironment = self.environment

        hubQ.send_not_ready(self.__class__.__name__)
        hubQ.send_not_ready("SourceSpoke")
        threadMgr.add(
            AnacondaThread(name=constants.THREAD_CHECK_SOFTWARE,
                           target=self.checkSoftwareSelection))