コード例 #1
0
ファイル: base.py プロジェクト: pombreda/anaconda
    def raw_input(self, prompt, hidden=False):
        """This method reads one input from user. Its basic form has only one
        line, but we might need to override it for more complex apps or testing."""

        input_thread = AnacondaThread(prefix=constants.THREAD_INPUT_BASENAME,
                                      target=self._thread_input,
                                      args=(self.queue, prompt, hidden))
        input_thread.daemon = True
        threadMgr.add(input_thread)
        event = self.process_events(return_at=hubQ.HUB_CODE_INPUT)
        return event[1][0] # return the user input
コード例 #2
0
ファイル: storage.py プロジェクト: jjmichaud/anaconda
    def initialize(self):
        NormalSpoke.initialize(self)

        self.local_disks_box = self.builder.get_object("local_disks_box")
        self.specialized_disks_box = self.builder.get_object(
            "specialized_disks_box")

        threadMgr.add(
            AnacondaThread(name=constants.THREAD_STORAGE_WATCHER,
                           target=self._initialize))
コード例 #3
0
def background_XklWrapper_initialize():
    """
    Create the XklWrapper singleton instance in a separate thread to save time
    when it's really needed.

    """

    threadMgr.add(
        AnacondaThread(name=THREAD_XKL_WRAPPER_INIT,
                       target=XklWrapper.get_instance))
コード例 #4
0
ファイル: software.py プロジェクト: numbnet/anaconda
    def apply(self):
        """ Apply our selections """
        self._apply()

        # no longer using values from kickstart
        self._kickstarted = False
        self.data.packages.seen = True

        threadMgr.add(AnacondaThread(name=THREAD_CHECK_SOFTWARE,
                                     target=self.checkSoftwareSelection))
コード例 #5
0
ファイル: zfcp.py プロジェクト: mopsfelder/anaconda
    def on_start_clicked(self, *args):
        """ Go through the process of validating entry contents and then
            attempt to add the device.
        """
        # First update widgets
        self._startButton.hide()
        self._cancelButton.set_sensitive(False)
        self._okButton.set_sensitive(False)
        self._set_configure_sensitive(False)
        self._conditionNotebook.set_current_page(1)

        # Initialize.
        config_error = None
        device = None
        wwpn = None
        lun = None

        # Get the input.
        device_name = self._deviceEntry.get_text().strip()
        wwpn_name = self._wwpnEntry.get_text().strip()
        lun_name = self._lunEntry.get_text().strip()

        # Check the input.
        if not DASD_DEVICE_NUMBER.match(device_name):
            config_error = "Incorrect format of the given device number."
        elif not ZFCP_WWPN_NUMBER.match(wwpn_name):
            config_error = "Incorrect format of the given WWPN number."
        elif not ZFCP_LUN_NUMBER.match(lun_name):
            config_error = "Incorrect format of the given LUN number."
        else:
            try:
                # Get the full ids.
                device = blockdev.s390.sanitize_dev_input(device_name)
                wwpn = blockdev.s390.zfcp_sanitize_wwpn_input(wwpn_name)
                lun = blockdev.s390.zfcp_sanitize_lun_input(lun_name)
            except (blockdev.S390Error, ValueError) as err:
                config_error = str(err)

        # Process the configuration error.
        if config_error:
            self._errorLabel.set_text(config_error)
            self._conditionNotebook.set_current_page(2)
            self._set_configure_sensitive(True)
            self._cancelButton.set_sensitive(True)
        # Start the discovery.
        else:
            # Discover.
            self._spinner.start()
            threadMgr.add(AnacondaThread(name=constants.THREAD_ZFCP_DISCOVER,
                                         target=self._discover,
                                         args=(device, wwpn, lun)))

            # Periodically call the check till it is done.
            GLib.timeout_add(250, self._check_discover)
コード例 #6
0
ファイル: livepayload.py プロジェクト: evildesign/anaconda
    def install(self):
        """ Install the payload. """

        if self.source_size <= 0:
            raise PayloadInstallError("Nothing to install")

        self.pct_lock = Lock()
        self.pct = 0
        threadMgr.add(
            AnacondaThread(name=THREAD_LIVE_PROGRESS, target=self.progress))

        cmd = "rsync"
        # preserve: permissions, owners, groups, ACL's, xattrs, times,
        #           symlinks, hardlinks
        # go recursively, include devices and special files, don't cross
        # file system boundaries
        args = [
            "-pogAXtlHrDx", "--exclude", "/dev/", "--exclude", "/proc/",
            "--exclude", "/sys/", "--exclude", "/run/", "--exclude",
            "/boot/*rescue*", "--exclude", "/etc/machine-id",
            INSTALL_TREE + "/",
            iutil.getSysroot()
        ]
        try:
            rc = iutil.execWithRedirect(cmd, args)
        except (OSError, RuntimeError) as e:
            msg = None
            err = str(e)
            log.error(err)
        else:
            err = None
            msg = "%s exited with code %d" % (cmd, rc)
            log.info(msg)

        if err or rc == 12:
            exn = PayloadInstallError(err or msg)
            if errorHandler.cb(exn) == ERROR_RAISE:
                raise exn

        # Wait for progress thread to finish
        with self.pct_lock:
            self.pct = 100
        threadMgr.wait(THREAD_LIVE_PROGRESS)

        # Live needs to create the rescue image before bootloader is written
        if not os.path.exists(iutil.getSysroot() + "/usr/sbin/new-kernel-pkg"):
            log.error(
                "new-kernel-pkg does not exist - grubby wasn't installed?  skipping"
            )
            return

        for kernel in self.kernelVersionList:
            log.info("Generating rescue image for %s", kernel)
            iutil.execInSysroot("new-kernel-pkg", ["--rpmposttrans", kernel])
コード例 #7
0
    def _restartThread(self, storage, ksdata, payload, instClass, fallback,
                       checkmount):
        # Wait for the old thread to finish
        threadMgr.wait(THREAD_PAYLOAD)

        # Start a new payload thread
        threadMgr.add(
            AnacondaThread(name=THREAD_PAYLOAD,
                           target=self._runThread,
                           args=(storage, ksdata, payload, instClass, fallback,
                                 checkmount)))
コード例 #8
0
ファイル: dasdfmt.py プロジェクト: fabiand/anaconda-1
    def on_format_clicked(self, *args):
        """
        Once the format button is clicked, the option to cancel expires.
        We also need to display the spinner showing activity.
        """
        self._cancel_button.set_sensitive(False)
        self._ok_button.set_sensitive(False)
        self._notebook.set_current_page(1)

        # Loop through all of our unformatted DASDs and format them
        threadMgr.add(AnacondaThread(name=constants.THREAD_DASDFMT,
                                target=self.run_dasdfmt, args=(self._epoch,)))
コード例 #9
0
ファイル: livepayload.py プロジェクト: evildesign/anaconda
    def install(self):
        """ Install the payload if it is a tar.
            Otherwise fall back to rsync of INSTALL_TREE
        """
        # If it doesn't look like a tarfile use the super's install()
        if not self.is_tarfile:
            super(LiveImageKSPayload, self).install()
            return

        # Use 2x the archive's size to estimate the size of the install
        # This is used to drive the progress display
        self.source_size = os.stat(self.image_path)[stat.ST_SIZE] * 2

        self.pct_lock = Lock()
        self.pct = 0
        threadMgr.add(
            AnacondaThread(name=THREAD_LIVE_PROGRESS, target=self.progress))

        cmd = "tar"
        # preserve: ACL's, xattrs, and SELinux context
        args = [
            "--selinux", "--acls", "--xattrs", "--xattrs-include", "*",
            "--exclude", "/dev/", "--exclude", "/proc/", "--exclude", "/sys/",
            "--exclude", "/run/", "--exclude", "/boot/*rescue*", "--exclude",
            "/etc/machine-id", "-xaf", self.image_path, "-C",
            iutil.getSysroot()
        ]
        try:
            rc = iutil.execWithRedirect(cmd, args)
        except (OSError, RuntimeError) as e:
            msg = None
            err = str(e)
            log.error(err)
        else:
            err = None
            msg = "%s exited with code %d" % (cmd, rc)
            log.info(msg)

        if err:
            exn = PayloadInstallError(err or msg)
            if errorHandler.cb(exn) == ERROR_RAISE:
                raise exn

        # Wait for progress thread to finish
        with self.pct_lock:
            self.pct = 100
        threadMgr.wait(THREAD_LIVE_PROGRESS)

        # Live needs to create the rescue image before bootloader is written
        for kernel in self.kernelVersionList:
            log.info("Generating rescue image for %s", kernel)
            iutil.execInSysroot("new-kernel-pkg", ["--rpmposttrans", kernel])
コード例 #10
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))
コード例 #11
0
    def on_add_clicked(self, *args):
        # Set some widgets to visible/not while we work.
        self._errorBox.hide()
        self._addSpinner.set_visible(True)
        self._addSpinner.show()

        for widget in [self._addButton, self._cancelButton, self._nicCombo,
                       self._dcbCheckbox, self._autoCheckbox]:
            widget.set_sensitive(False)

        self._addSpinner.start()

        threadMgr.add(AnacondaThread(name=constants.THREAD_FCOE, target=self._add))
コード例 #12
0
    def refresh(self):
        from pyanaconda.install import doInstall
        from pyanaconda.threads import threadMgr, AnacondaThread

        Hub.refresh(self)

        self._start_ransom_notes()
        GLib.timeout_add(250, self._update_progress, self._install_done)
        threadMgr.add(
            AnacondaThread(name=THREAD_INSTALL,
                           target=doInstall,
                           args=(self.storage, self.payload, self.data,
                                 self.instclass)))
コード例 #13
0
    def initialize(self):
        NormalSpoke.initialize(self)
        self._daysStore = self.builder.get_object("days")
        self._monthsStore = self.builder.get_object("months")
        self._yearsStore = self.builder.get_object("years")
        self._regionsStore = self.builder.get_object("regions")
        self._citiesStore = self.builder.get_object("cities")
        self._tzmap = self.builder.get_object("tzmap")

        # we need to know it the new value is the same as previous or not
        self._old_region = None
        self._old_city = None

        self._regionCombo = self.builder.get_object("regionCombobox")
        self._cityCombo = self.builder.get_object("cityCombobox")
        self._monthCombo = self.builder.get_object("monthCombobox")
        self._dayCombo = self.builder.get_object("dayCombobox")
        self._yearCombo = self.builder.get_object("yearCombobox")

        self._daysFilter = self.builder.get_object("daysFilter")
        self._daysFilter.set_visible_func(self.existing_date, None)

        self._citiesFilter = self.builder.get_object("citiesFilter")
        self._citiesFilter.set_visible_func(self.city_in_region, None)

        self._hoursLabel = self.builder.get_object("hoursLabel")
        self._minutesLabel = self.builder.get_object("minutesLabel")
        self._amPmUp = self.builder.get_object("amPmUpButton")
        self._amPmDown = self.builder.get_object("amPmDownButton")
        self._amPmLabel = self.builder.get_object("amPmLabel")
        self._radioButton24h = self.builder.get_object("timeFormatRB")

        self._ntpSwitch = self.builder.get_object("networkTimeSwitch")

        self._regions_zones = get_all_regions_and_timezones()

        self._months_nums = dict()

        # Set the initial sensitivity of the AM/PM toggle based on the time-type selected
        self._radioButton24h.emit("toggled")

        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()

        threadMgr.add(AnacondaThread(name=constants.THREAD_DATE_TIME,
                                     target=self._initialize))
コード例 #14
0
ファイル: progress.py プロジェクト: bcl/anaconda
    def refresh(self, args=None):
        from pyanaconda.install import doInstall, doConfiguration
        from pyanaconda.threads import threadMgr, AnacondaThread

        # We print this here because we don't really use the window object
        print(_(self.title))

        threadMgr.add(
            AnacondaThread(name=THREAD_INSTALL,
                           target=doInstall,
                           args=(self.storage, self.payload, self.data,
                                 self.instclass)))

        # This will run until we're all done with the install thread.
        self._update_progress()

        threadMgr.add(
            AnacondaThread(name=THREAD_CONFIGURATION,
                           target=doConfiguration,
                           args=(self.storage, self.payload, self.data,
                                 self.instclass)))

        # This will run until we're all done with the configuration thread.
        self._update_progress()

        iutil.ipmi_report(IPMI_FINISHED)

        # kickstart install, continue automatically if reboot or shutdown selected
        if flags.automatedInstall and self.data.reboot.action in [
                KS_REBOOT, KS_SHUTDOWN
        ]:
            # Just pretend like we got input, and our input doesn't care
            # what it gets, it just quits.
            self.input(None, None)

        return True
コード例 #15
0
    def on_rescan_clicked(self, button):
        # Once the rescan button is clicked, the option to cancel expires.
        # We also need to display the spinner showing activity.
        self._cancel_button.set_sensitive(False)
        self._ok_button.set_sensitive(False)
        self._notebook.set_current_page(1)

        # And now to fire up the storage reinitialization.
        threadMgr.add(AnacondaThread(name=constants.THREAD_STORAGE, target=storageInitialize,
                                     args=(self.storage, self.data, self.storage.devicetree.protectedDevNames)))

        self._elapsed = 0

        # This watches for the rescan to be finished and updates the dialog when
        # that happens.
        self._watcher_id = GLib.timeout_add_seconds(1, self._check_rescan)
コード例 #16
0
    def __init__(self, *args, **kwargs):
        NormalSpoke.__init__(self, *args, **kwargs)
        self.applyOnSkip = True

        self._ready = False
        self.selected_disks = self.data.ignoredisk.onlyuse[:]

        # This list contains all possible disks that can be included in the install.
        # All types of advanced disks should be set up for us ahead of time, so
        # there should be no need to modify this list.
        self.disks = []

        self._confirmed = True
        # if set to False, it means the user needs to confirm the current
        # storage configuration

        if flags.automatedInstall:
            # now we have to check if some form of partitioning is specified
            # in the current kickstart
            if not any((self.data.partition.seen, self.data.logvol.seen,
                        self.data.volgroup.seen, self.data.raid.seen,
                        self.data.btrfs.seen, self.data.autopart.seen)):
                # no partitioning specified, so use autopart
                # but prompt the user to confirm it
                self.data.autopart.autopart = True
                self._confirmed = False
        else:
            # default to using autopart for interactive installs
            self.data.autopart.autopart = True

        self.autopart = self.data.autopart.autopart
        self.autoPartType = None
        self.clearPartType = CLEARPART_TYPE_NONE

        if self.data.zerombr.zerombr and arch.isS390():
            # run dasdfmt on any unformatted DASDs automatically
            threadMgr.add(
                AnacondaThread(name=constants.THREAD_DASDFMT,
                               target=self.run_dasdfmt))

        self._previous_autopart = False

        self._last_clicked_overview = None
        self._cur_clicked_overview = None

        self._grabObjects()
コード例 #17
0
    def refresh(self):
        """Refresh location info"""
        # first check if a provider is available
        if self._provider is None:
            log.error("Geoloc: can't refresh - no provider")
            return

        # then check if a refresh is already in progress
        if threadMgr.get(constants.THREAD_GEOLOCATION_REFRESH):
            log.debug("Geoloc: refresh already in progress")
        else:  # wait for Internet connectivity
            if network.wait_for_connectivity():
                threadMgr.add(
                    AnacondaThread(name=constants.THREAD_GEOLOCATION_REFRESH,
                                   target=self._provider.refresh))
            else:
                log.error("Geolocation refresh failed" " - no connectivity")
コード例 #18
0
ファイル: keyboard.py プロジェクト: KosiehBarter/anaconda
    def initialize(self):
        # We want to store layouts' names but show layouts as
        # 'language (description)'.
        self._entry = self.builder.get_object("addLayoutEntry")
        layoutColumn = self.builder.get_object("newLayoutColumn")
        layoutRenderer = self.builder.get_object("newLayoutRenderer")
        override_cell_property(layoutColumn, layoutRenderer, "text", _show_layout,
                               self._xkl_wrapper)
        self._treeModelFilter = self.builder.get_object("newLayoutStoreFilter")
        self._treeModelFilter.set_visible_func(self.matches_entry, None)
        self._treeModelSort = self.builder.get_object("newLayoutStoreSort")
        self._treeModelSort.set_default_sort_func(self.compare_layouts, None)

        self._confirmAddButton = self.builder.get_object("confirmAddButton")
        self._newLayoutSelection = self.builder.get_object("newLayoutSelection")

        self._store = self.builder.get_object("newLayoutStore")
        threadMgr.add(AnacondaThread(name=THREAD_ADD_LAYOUTS_INIT,
                                     target=self._initialize))
コード例 #19
0
    def _do_configuration(self, widget = None, reenable_ransom = True):
        from pyanaconda.install import doConfiguration
        from pyanaconda.threads import threadMgr, AnacondaThread

        assert self._configurationDone == False

        self._configurationDone = True

        # Disable all personalization spokes
        self.builder.get_object("progressWindow-scroll").set_sensitive(False)

        if reenable_ransom:
            self._start_ransom_notes()

        self._restart_spinner()

        GLib.timeout_add(250, self._update_progress, self._configuration_done)
        threadMgr.add(AnacondaThread(name=THREAD_CONFIGURATION, target=doConfiguration,
                                     args=(self.storage, self.payload, self.data, self.instclass)))
コード例 #20
0
ファイル: datetime_spoke.py プロジェクト: mykntom/anaconda
    def initialize(self):
        NormalSpoke.initialize(self)
        self._daysStore = self.builder.get_object("days")
        self._monthsStore = self.builder.get_object("months")
        self._yearsStore = self.builder.get_object("years")
        self._regionsStore = self.builder.get_object("regions")
        self._citiesStore = self.builder.get_object("cities")
        self._tzmap = self.builder.get_object("tzmap")

        # we need to know it the new value is the same as previous or not
        self._old_region = None
        self._old_city = None

        self._regionCombo = self.builder.get_object("regionCombobox")
        self._cityCombo = self.builder.get_object("cityCombobox")
        self._monthCombo = self.builder.get_object("monthCombobox")
        self._dayCombo = self.builder.get_object("dayCombobox")
        self._yearCombo = self.builder.get_object("yearCombobox")

        self._daysFilter = self.builder.get_object("daysFilter")
        self._daysFilter.set_visible_func(self.existing_date, None)

        self._citiesFilter = self.builder.get_object("citiesFilter")
        self._citiesFilter.set_visible_func(self.city_in_region, None)

        self._citiesSort = self.builder.get_object("citiesSort")
        self._citiesSort.set_sort_column_id(0, Gtk.SortType.ASCENDING)

        self._hoursLabel = self.builder.get_object("hoursLabel")
        self._minutesLabel = self.builder.get_object("minutesLabel")
        self._amPmUp = self.builder.get_object("amPmUpButton")
        self._amPmDown = self.builder.get_object("amPmDownButton")
        self._amPmLabel = self.builder.get_object("amPmLabel")
        self._radioButton24h = self.builder.get_object("timeFormatRB")

        self._ntpSwitch = self.builder.get_object("networkTimeSwitch")

        self._regions_zones = get_all_regions_and_timezones()

        self._months_nums = dict()

        threadMgr.add(AnacondaThread(name=constants.THREAD_DATE_TIME,
                                     target=self._initialize))
コード例 #21
0
ファイル: ntp.py プロジェクト: nullr0ute/anaconda
def one_time_sync_async(server, callback=None):
    """
    Asynchronously synchronize the system time with a given NTP server. This
    function is non-blocking it starts a new thread for synchronization and
    returns. Use callback argument to specify the function called when the
    new thread finishes if needed.

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

    """

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

    threadMgr.add(AnacondaThread(name=thread_name, target=one_time_sync,
                                 args=(server, callback)))
コード例 #22
0
ファイル: software.py プロジェクト: evildesign/anaconda
    def _apply(self):
        """ Private apply. """
        self.environment = self._get_environment(self._selection)
        self.addons = self._addons_selection if self.environment is not None else set(
        )

        if not self.environment:
            return

        changed = False

        # Not a kickstart with packages, setup the selected environment and addons
        if not self._kickstarted:

            # Changed the environment or addons, clear and setup
            if not self._origEnv \
                    or self._origEnv != self.environment \
                    or set(self._origAddons) != set(self.addons):

                self.payload.data.packages.packageList = []
                self.data.packages.groupList = []
                self.payload.selectEnvironment(self.environment)

                environment_id = self._get_environment_id(self.environment)
                available_addons = self._get_available_addons(environment_id)

                for addon_id in available_addons:
                    if addon_id in self.addons:
                        self.payload.selectGroup(addon_id)

                changed = True

            self._origEnv = self.environment
            self._origAddons = set(self.addons)

        # Check the software selection
        if changed or self._kickstarted:
            threadMgr.add(
                AnacondaThread(name=THREAD_CHECK_SOFTWARE,
                               target=self.checkSoftwareSelection))
コード例 #23
0
ファイル: storage.py プロジェクト: fabiand/anaconda-1
    def __init__(self, *args, **kwargs):
        StorageChecker.__init__(self, min_ram=isys.MIN_GUI_RAM)
        NormalSpoke.__init__(self, *args, **kwargs)
        self.applyOnSkip = True

        self._ready = False
        self.autoPartType = None
        self.encrypted = False
        self.passphrase = ""
        self.selected_disks = self.data.ignoredisk.onlyuse[:]
        self._last_selected_disks = None
        self._back_clicked = False
        self.autopart_missing_passphrase = False
        self.disks_errors = []

        # This list contains all possible disks that can be included in the install.
        # All types of advanced disks should be set up for us ahead of time, so
        # there should be no need to modify this list.
        self.disks = []

        if not flags.automatedInstall:
            # default to using autopart for interactive installs
            self.data.autopart.autopart = True

        self.autopart = self.data.autopart.autopart
        self.autoPartType = None
        self.clearPartType = CLEARPART_TYPE_NONE

        if self.data.zerombr.zerombr and arch.isS390():
            # run dasdfmt on any unformatted DASDs automatically
            threadMgr.add(
                AnacondaThread(name=constants.THREAD_DASDFMT,
                               target=self.run_dasdfmt))

        self._previous_autopart = False

        self._last_clicked_overview = None
        self._cur_clicked_overview = None

        self._grabObjects()
コード例 #24
0
ファイル: storage.py プロジェクト: yaneti/anaconda
    def execute(self):
        # Spawn storage execution as a separate thread so there's no big delay
        # going back from this spoke to the hub while StorageChecker.run runs.
        # Yes, this means there's a thread spawning another thread.  Sorry.
        threadMgr.add(
            AnacondaThread(name=constants.THREAD_EXECUTE_STORAGE,
                           target=self._doExecute))

        # Register iSCSI to kickstart data
        iscsi_devices = []
        # Find all selected disks and add all iscsi disks to iscsi_devices list
        for d in [
                d for d in getDisks(self.storage.devicetree)
                if d.name in self.selected_disks
        ]:
            # Get parents of a multipath devices
            if isinstance(d, MultipathDevice):
                for parent_dev in d.parents:
                    if isinstance(parent_dev,
                                  iScsiDiskDevice) and not parent_dev.ibft:
                        iscsi_devices.append(parent_dev)
            # Add no-ibft iScsiDiskDevice. IBFT disks are added automatically so there is
            # no need to have them in KS.
            elif isinstance(d, iScsiDiskDevice) and not d.ibft:
                iscsi_devices.append(d)

        if iscsi_devices:
            self.data.iscsiname.iscsiname = self.storage.iscsi.initiator
            # Remove the old iscsi data information and generate new one
            self.data.iscsi.iscsi = []
            for device in iscsi_devices:
                iscsi_data = self._create_iscsi_data(device)
                for saved_iscsi in self.data.iscsi.iscsi:
                    if (iscsi_data.ipaddr == saved_iscsi.ipaddr
                            and iscsi_data.target == saved_iscsi.target
                            and iscsi_data.port == saved_iscsi.port):
                        break
                else:
                    self.data.iscsi.iscsi.append(iscsi_data)
コード例 #25
0
ファイル: oscap.py プロジェクト: dardok/oscap-anaconda-addon
    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
            try:
                thread_name = common.wait_and_fetch_net_data(
                    self._addon_data.content_url,
                    self._addon_data.raw_preinst_content_path,
                    self._addon_data.certificates)
            except common.OSCAPaddonNetworkError:
                self._network_problem()
                with self._fetch_flag_lock:
                    self._fetching = False
                return
            except KickstartValueError:
                self._invalid_url()
                with self._fetch_flag_lock:
                    self._fetching = False
                return

        # 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, )))
コード例 #26
0
ファイル: livepayload.py プロジェクト: mykntom/anaconda
    def install(self):
        """ Install the payload. """
        self.pct_lock = Lock()
        self.pct = 0
        threadMgr.add(
            AnacondaThread(name=THREAD_LIVE_PROGRESS, target=self.progress))

        cmd = "rsync"
        # preserve: permissions, owners, groups, ACL's, xattrs, times,
        #           symlinks, hardlinks
        # go recursively, include devices and special files, don't cross
        # file system boundaries
        args = [
            "-pogAXtlHrDx", "--exclude", "/dev/", "--exclude", "/proc/",
            "--exclude", "/sys/", "--exclude", "/run/", "--exclude",
            "/boot/*rescue*", "--exclude", "/etc/machine-id",
            INSTALL_TREE + "/", ROOT_PATH
        ]
        try:
            rc = iutil.execWithRedirect(cmd, args)
        except (OSError, RuntimeError) as e:
            msg = None
            err = str(e)
            log.error(err)
        else:
            err = None
            msg = "%s exited with code %d" % (cmd, rc)
            log.info(msg)

        if err or rc == 12:
            exn = PayloadInstallError(err or msg)
            if errorHandler.cb(exn) == ERROR_RAISE:
                raise exn

        # Wait for progress thread to finish
        with self.pct_lock:
            self.pct = 100
        threadMgr.wait(THREAD_LIVE_PROGRESS)
コード例 #27
0
    def initialize(self):
        NormalSpoke.initialize(self)

        # Wouldn't it be nice if glade knew how to do this?
        label = self.builder.get_object("summary_button").get_children()[0]
        markup = "<span foreground='blue'><u>%s</u></span>" % label.get_text()
        label.set_use_markup(True)
        label.set_markup(markup)

        specializedButton = self.builder.get_object("addSpecializedButton")

        # It's uh... uh... it's down there somewhere, let me take another look.
        label = specializedButton.get_children()[0].get_children()[0].get_children()[1]
        markup = "<span size='large'><b>%s</b></span>" % label.get_text()
        label.set_use_markup(True)
        label.set_markup(markup)
        specializedButton.show_all()

        self.local_disks_box = self.builder.get_object("local_disks_box")
        self.specialized_disks_box = self.builder.get_object("specialized_disks_box")

        threadMgr.add(AnacondaThread(name=constants.THREAD_STORAGE_WATCHER,
                      target=self._initialize))
コード例 #28
0
    def _apply(self):
        if self.environment and not (flags.automatedInstall
                                     and self.data.packages.seen):
            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(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))
コード例 #29
0
ファイル: storage.py プロジェクト: fabiand/anaconda-1
    def initialize(self):
        NormalSpoke.initialize(self)

        self.local_disks_box = self.builder.get_object("local_disks_box")
        self.specialized_disks_box = self.builder.get_object(
            "specialized_disks_box")

        # Connect the viewport adjustments to the child widgets
        # See also https://bugzilla.gnome.org/show_bug.cgi?id=744721
        localViewport = self.builder.get_object("localViewport")
        specializedViewport = self.builder.get_object("specializedViewport")
        self.local_disks_box.set_focus_hadjustment(
            localViewport.get_hadjustment())
        self.specialized_disks_box.set_focus_hadjustment(
            specializedViewport.get_hadjustment())

        mainViewport = self.builder.get_object("storageViewport")
        mainBox = self.builder.get_object("storageMainBox")
        mainBox.set_focus_vadjustment(mainViewport.get_vadjustment())

        threadMgr.add(
            AnacondaThread(name=constants.THREAD_STORAGE_WATCHER,
                           target=self._initialize))
コード例 #30
0
ファイル: source.py プロジェクト: mykntom/anaconda
    def initialize(self):
        NormalSpoke.initialize(self)

        self._grabObjects()

        # I shouldn't have to do this outside GtkBuilder, but it really doesn't
        # want to let me pass in user data.
        self._autodetectButton.connect("toggled", self.on_source_toggled,
                                       self._autodetectBox)
        self._isoButton.connect("toggled", self.on_source_toggled,
                                self._isoBox)
        self._networkButton.connect("toggled", self.on_source_toggled,
                                    self._networkBox)

        # Show or hide the updates option based on the installclass
        if self.instclass.installUpdates:
            really_show(self._updatesBox)
        else:
            really_hide(self._updatesBox)

        threadMgr.add(
            AnacondaThread(name=constants.THREAD_SOURCE_WATCHER,
                           target=self._initialize))
コード例 #31
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))