Exemple #1
0
def reset_storage(scan_all=False, retry=True):
    """Reset the storage model.

    :param scan_all: should we scan all devices in the system?
    :param retry: should we allow to retry the reset?
    """
    # Clear the exclusive disks to scan all devices in the system.
    if scan_all:
        disk_select_proxy = STORAGE.get_proxy(DISK_SELECTION)
        disk_select_proxy.SetExclusiveDisks([])

    # Scan the devices.
    storage_proxy = STORAGE.get_proxy()

    while True:
        try:
            task_path = storage_proxy.ScanDevicesWithTask()
            task_proxy = STORAGE.get_proxy(task_path)
            sync_run_task(task_proxy)
        except DBusError as e:
            # Is the retry allowed?
            if not retry:
                raise
            # Does the user want to retry?
            elif error_handler.cb(e) == ERROR_RAISE:
                raise
            # Retry the storage reset.
            else:
                continue
        else:
            # No need to retry.
            break

    # Reset the partitioning.
    storage_proxy.ResetPartitioning()
Exemple #2
0
    def do_format(self):
        """Format with a remote task."""
        disk_names = [disk.name for disk in self._dasds]
        task_path = self._dasd_module.FormatWithTask(disk_names)

        task_proxy = STORAGE.get_proxy(task_path)
        sync_run_task(task_proxy, callback=self._report_progress)
    def do_format(self):
        """Format with a remote task."""
        disk_names = [disk.name for disk in self._dasds]
        task_path = self._dasd_module.FormatWithTask(disk_names)

        task_proxy = STORAGE.get_proxy(task_path)
        sync_run_task(task_proxy, callback=self._report_progress)
Exemple #4
0
def tear_down_sources(payload_proxy):
    """Tear down the sources of the given payload.

    :param payload_proxy: a DBus proxy of a payload
    """
    task_path = payload_proxy.TearDownSourcesWithTask()
    task_proxy = PAYLOADS.get_proxy(task_path)
    sync_run_task(task_proxy)
Exemple #5
0
    def run_install_bootloader():
        tasks = bootloader_proxy.InstallBootloaderWithTasks(
            payload.type,
            payload.kernel_version_list
        )

        for task in tasks:
            sync_run_task(STORAGE.get_proxy(task))
Exemple #6
0
def set_up_sources(payload_proxy):
    """Set up the sources of the given payload.

    :param payload_proxy: a DBus proxy of a payload
    """
    task_path = payload_proxy.SetUpSourcesWithTask()
    task_proxy = PAYLOADS.get_proxy(task_path)
    sync_run_task(task_proxy)
Exemple #7
0
    def run_generate_initramfs():
        tasks = bootloader_proxy.GenerateInitramfsWithTasks(
            payload.type,
            payload.kernel_version_list
        )

        for task in tasks:
            sync_run_task(STORAGE.get_proxy(task))
Exemple #8
0
def run_network_initialization_task(task_path):
    """Run network initialization task and log the result."""
    task_proxy = NETWORK.get_proxy(task_path)
    log.debug("Running task %s", task_proxy.Name)
    sync_run_task(task_proxy)
    result = task_proxy.GetResult()
    msg = "%s result: %s" % (task_proxy.Name, result)
    log.debug(msg)
Exemple #9
0
def run_network_initialization_task(task_path):
    """Run network initialization task and log the result."""
    task_proxy = NETWORK.get_proxy(task_path)
    log.debug("Running task %s", task_proxy.Name)
    sync_run_task(task_proxy)
    result = get_native(task_proxy.GetResult())
    msg = "%s result: %s" % (task_proxy.Name, result)
    log.debug(msg)
    def set_from_opts(self, opts):
        """Detect the Live OS image."""
        # Create the image source.
        source_proxy = self.get_source_proxy()

        # Detect the image path.
        task_path = source_proxy.DetectImageWithTask()
        task_proxy = PAYLOADS.get_proxy(task_path)
        sync_run_task(task_proxy)
Exemple #11
0
    def _run_tasks(self, task_paths, progress_cb=None):
        """Run the given remote tasks of the Payload module."""
        for task_path in task_paths:
            task_proxy = PAYLOADS.get_proxy(task_path)

            if progress_cb:
                task_proxy.ProgressChanged.connect(progress_cb)

            sync_run_task(task_proxy)
def start_anaconda_services():
    print(RED + "starting Boss" + RESET)
    bus_proxy = test_dbus_connection.proxy
    bus_proxy.StartServiceByName(BOSS.service_name, 0)

    boss_proxy = test_dbus_connection.get_proxy(BOSS.service_name,
                                                BOSS.object_path)
    task_path = boss_proxy.StartModulesWithTask()
    task_proxy = test_dbus_connection.get_proxy(BOSS.service_name, task_path)
    sync_run_task(task_proxy)
Exemple #13
0
def activate_keyboard(localization_proxy):
    """
    Try to setup VConsole keymap and X11 layouts as specified in kickstart.

    :param localization_proxy: DBus proxy of the localization module or None

    """
    task_path = localization_proxy.ApplyKeyboardWithTask()
    task_proxy = LOCALIZATION.get_proxy(task_path)
    sync_run_task(task_proxy)
Exemple #14
0
    def mount_root(self, root):
        """Mounts selected root and runs scripts."""
        # mount root fs
        try:
            task_path = self._device_tree_proxy.MountExistingSystemWithTask(
                root.get_root_device(),
                self.ro
            )
            task_proxy = STORAGE.get_proxy(task_path)
            sync_run_task(task_proxy)
            log.info("System has been mounted under: %s", conf.target.system_root)
        except MountFilesystemError as e:
            log.error("Mounting system under %s failed: %s", conf.target.system_root, e)
            self.status = RescueModeStatus.MOUNT_FAILED
            self.error = e
            return False

        # turn on selinux also
        if conf.security.selinux:
            # we have to catch the possible exception, because we
            # support read-only mounting
            try:
                fd = open("%s/.autorelabel" % conf.target.system_root, "w+")
                fd.close()
            except IOError as e:
                log.warning("Error turning on selinux: %s", e)

        # set a libpath to use mounted fs
        libdirs = os.environ.get("LD_LIBRARY_PATH", "").split(":")
        mounted = ["/mnt/sysimage%s" % ldir for ldir in libdirs]
        util.setenv("LD_LIBRARY_PATH", ":".join(libdirs + mounted))

        # do we have bash?
        try:
            if os.access("/usr/bin/bash", os.R_OK):
                os.symlink("/usr/bin/bash", "/bin/bash")
        except OSError as e:
            log.error("Error symlinking bash: %s", e)

        # make resolv.conf in chroot
        if not self.ro:
            try:
                makeResolvConf(conf.target.system_root)
            except(OSError, IOError) as e:
                log.error("Error making resolv.conf: %s", e)

        # create /etc/fstab in ramdisk so it's easier to work with RO mounted fs
        makeFStab()

        # run %post if we've mounted everything
        if not self.ro and self._scripts:
            runPostScripts(self._scripts)

        self.status = RescueModeStatus.MOUNTED
        return True
Exemple #15
0
def populate_missing_items(localization_proxy=None):
    """
    Function that populates virtual console keymap and X layouts if they
    are missing. By invoking systemd-localed methods this function READS AND
    WRITES CONFIGURATION FILES (but tries to keep their content unchanged).

    :param localization_proxy: DBus proxy of the localization module or None

    """
    task_path = localization_proxy.PopulateMissingKeyboardConfigurationWithTask()
    task_proxy = LOCALIZATION.get_proxy(task_path)
    sync_run_task(task_proxy)
Exemple #16
0
    def execute(self, storage, payload):
        fcoe_ifaces = network.devices_used_by_fcoe(storage)
        overwrite = network.can_overwrite_configuration(payload)
        network_proxy = NETWORK.get_proxy()
        task_path = network_proxy.InstallNetworkWithTask(
            util.getSysroot(), fcoe_ifaces, overwrite)
        task_proxy = NETWORK.get_proxy(task_path)
        sync_run_task(task_proxy)

        if conf.system.can_change_hostname:
            hostname = network_proxy.Hostname
            if hostname != network.DEFAULT_HOSTNAME:
                network_proxy.SetCurrentHostname(hostname)
Exemple #17
0
    def find_roots(self):
        """List of found roots."""
        task_path = self._device_tree_proxy.FindExistingSystemsWithTask()

        task_proxy = STORAGE.get_proxy(task_path)
        sync_run_task(task_proxy)

        roots = OSData.from_structure_list(
            self._device_tree_proxy.GetExistingSystems())

        if not roots:
            self.status = RescueModeStatus.ROOT_NOT_FOUND

        return roots
Exemple #18
0
    def run_task(self):
        """Run the DBus task."""
        try:
            # Report the progress messages.
            self._task_proxy.ProgressChanged.connect(self._show_message)

            # Run the task.
            sync_run_task(self._task_proxy)
        except DBusError as e:
            # Handle a remote error.
            if errorHandler.cb(e) == ERROR_RAISE:
                raise
        finally:
            # Disconnect from the signal.
            self._task_proxy.ProgressChanged.disconnect()
Exemple #19
0
    def execute(self, payload):
        fcoe_proxy = STORAGE.get_proxy(FCOE)
        fcoe_nics = fcoe_proxy.GetNics()
        fcoe_ifaces = [dev.device_name for dev in network.get_supported_devices()
                       if dev.device_name in fcoe_nics]
        overwrite = network.can_overwrite_configuration(payload)
        network_proxy = NETWORK.get_proxy()
        task_path = network_proxy.InstallNetworkWithTask(util.getSysroot(),
                                                         fcoe_ifaces,
                                                         overwrite)
        task_proxy = NETWORK.get_proxy(task_path)
        sync_run_task(task_proxy)

        if conf.system.can_change_hostname:
            hostname = network_proxy.Hostname
            if hostname != network.DEFAULT_HOSTNAME:
                network_proxy.SetCurrentHostname(hostname)
Exemple #20
0
    def execute(self, payload):
        fcoe_proxy = STORAGE.get_proxy(FCOE)
        fcoe_nics = fcoe_proxy.GetNics()
        fcoe_ifaces = [dev.device_name for dev in network.get_supported_devices()
                       if dev.device_name in fcoe_nics]
        overwrite = network.can_overwrite_configuration(payload)
        network_proxy = NETWORK.get_proxy()
        task_path = network_proxy.InstallNetworkWithTask(util.getSysroot(),
                                                         fcoe_ifaces,
                                                         overwrite)
        task_proxy = NETWORK.get_proxy(task_path)
        sync_run_task(task_proxy)

        if conf.system.can_change_hostname:
            hostname = network_proxy.Hostname
            if hostname != network.DEFAULT_HOSTNAME:
                network_proxy.SetCurrentHostname(hostname)
Exemple #21
0
    def _do_check(self):
        self.clear_errors()
        StorageCheckHandler.errors = []
        StorageCheckHandler.warnings = []

        try:
            log.debug("Generating updated storage configuration")
            task_path = self._partitioning.ConfigureWithTask()
            task_proxy = STORAGE.get_proxy(task_path)
            sync_run_task(task_proxy)
        except BootloaderConfigurationError as e:
            log.error("Storage configuration failed: %s", e)
            StorageCheckHandler.errors = [str(e)]
            reset_bootloader()
        else:
            log.debug("Checking storage configuration...")
            task_path = self._partitioning.ValidateWithTask()
            task_proxy = STORAGE.get_proxy(task_path)
            sync_run_task(task_proxy)

            result = unwrap_variant(task_proxy.GetResult())
            report = ValidationReport.from_structure(result)

            log.debug("Validation has been completed: %s", report)
            StorageCheckHandler.errors = report.error_messages
            StorageCheckHandler.warnings = report.warning_messages

            if report.is_valid():
                self._storage_module.ApplyPartitioning(
                    get_object_path(self._partitioning))

        if self.errors:
            self.set_warning(
                _("Error checking storage configuration.  <a href=\"\">Click for details</a> or press Done again to continue."
                  ))
        elif self.warnings:
            self.set_warning(
                _("Warning checking storage configuration.  <a href=\"\">Click for details</a> or press Done again to continue."
                  ))

        # on_info_bar_clicked requires self._error to be set, so set it to the
        # list of all errors and warnings that storage checking found.
        self._error = "\n".join(self.errors + self.warnings)

        return self._error == ""
Exemple #22
0
def unregister(progress_callback=None, error_callback=None):
    """Try to unregister the installation environment.

    NOTE: Unregistering also removes any attached subscriptions

    :param progress_callback: progress callback function, takes one argument, subscription phase
    :type progress_callback: callable(subscription_phase)
    :param error_callback: error callback function, takes one argument, the error message
    :type error_callback: callable(error_message)
    """

    # assign dummy callback functions if none were provided by caller
    if progress_callback is None:
        progress_callback = dummy_progress_callback
    if error_callback is None:
        error_callback = dummy_error_callback

    # connect to the Subscription DBus module
    subscription_proxy = SUBSCRIPTION.get_proxy()

    if subscription_proxy.IsRegistered:
        log.debug("subscription thread: unregistering the system")
        # Make sure to set RHSM config options to be in sync
        # with the current subscription request in the unlikely
        # case of someone doing a valid change in the subscription
        # request since we registered.
        task_path = subscription_proxy.SetRHSMConfigWithTask()
        task_proxy = SUBSCRIPTION.get_proxy(task_path)
        task.sync_run_task(task_proxy)
        progress_callback(SubscriptionPhase.UNREGISTER)
        task_path = subscription_proxy.UnregisterWithTask()
        task_proxy = SUBSCRIPTION.get_proxy(task_path)
        try:
            task.sync_run_task(task_proxy)
        except UnregistrationError as e:
            log.debug("subscription thread: unregistration failed: %s", e)
            error_callback(str(e))
            return
        log.debug("Subscription GUI: unregistration succeeded")
        progress_callback(SubscriptionPhase.DONE)
    else:
        log.warning("subscription thread: not registered, so can't unregister")
        progress_callback(SubscriptionPhase.DONE)
        return
Exemple #23
0
    def _apply_system_purpose_data(self):
        """Apply system purpose data to the installation environment.

        Apply system purpose data to the installation environment, provided that:
        - system purpose data has not yet been applied to the system
        or
        - current system purpose data is different from the data last applied to the system

        Due to that we keep a copy of the last applied system purpose data so that we can
        check for difference.

        If the last applied data is the same as current system purpose data, nothing is done.
        """
        if self._last_applied_system_purpose_data != self.system_purpose_data:
            log.debug("Subscription GUI: applying system purpose data to installation environment")
            task_path = self._subscription_module.SetSystemPurposeWithTask()
            task_proxy = SUBSCRIPTION.get_proxy(task_path)
            sync_run_task(task_proxy)
            self._last_applied_system_purpose_data = self.system_purpose_data
Exemple #24
0
def apply_partitioning(partitioning, show_message_cb, reset_storage_cb):
    """Apply the given partitioning.

    :param partitioning: a DBus proxy of a partitioning
    :param show_message_cb: a callback for showing a message
    :param reset_storage_cb: a callback for resetting the storage
    :return: an instance of ValidationReport
    """
    log.debug("Applying partitioning")
    report = ValidationReport()

    try:
        show_message_cb(_("Saving storage configuration..."))
        task_path = partitioning.ConfigureWithTask()
        task_proxy = STORAGE.get_proxy(task_path)
        sync_run_task(task_proxy)
    except StorageConfigurationError as e:
        show_message_cb(_("Failed to save storage configuration"))
        report.error_messages.append(str(e))
        reset_bootloader()
        reset_storage_cb()
    except BootloaderConfigurationError as e:
        show_message_cb(_("Failed to save boot loader configuration"))
        report.error_messages.append(str(e))
        reset_bootloader()
    else:
        show_message_cb(_("Checking storage configuration..."))
        task_path = partitioning.ValidateWithTask()
        task_proxy = STORAGE.get_proxy(task_path)
        sync_run_task(task_proxy)

        result = unwrap_variant(task_proxy.GetResult())
        report = ValidationReport.from_structure(result)
        log.debug("Validation has been completed: %s", report)

        if report.is_valid():
            storage_proxy = STORAGE.get_proxy()
            storage_proxy.ApplyPartitioning(get_object_path(partitioning))
            log.debug("Partitioning has been applied.")

    return report
Exemple #25
0
def write_configuration(overwrite=False):
    """Install network configuration to target system."""
    fcoe_proxy = STORAGE.get_proxy(FCOE)
    fcoe_nics = fcoe_proxy.GetNics()
    fcoe_ifaces = [
        dev.device_name for dev in get_supported_devices()
        if dev.device_name in fcoe_nics
    ]
    network_proxy = NETWORK.get_proxy()

    task_path = network_proxy.ConfigureActivationOnBootWithTask(fcoe_ifaces)
    task_proxy = NETWORK.get_proxy(task_path)
    sync_run_task(task_proxy)

    task_path = network_proxy.InstallNetworkWithTask(overwrite)
    task_proxy = NETWORK.get_proxy(task_path)
    sync_run_task(task_proxy)

    task_path = network_proxy.ConfigureHostnameWithTask(overwrite)
    task_proxy = NETWORK.get_proxy(task_path)
    sync_run_task(task_proxy)

    if conf.system.can_change_hostname:
        hostname = network_proxy.Hostname
        if hostname != DEFAULT_HOSTNAME:
            network_proxy.SetCurrentHostname(hostname)
Exemple #26
0
def try_populate_devicetree():
    """Try to populate a device tree.

    Try to populate the device tree while catching errors and dealing with
    some special ones in a nice way (giving user chance to do something about
    them).
    """
    device_tree = STORAGE.get_proxy(DEVICE_TREE)

    while True:
        try:
            task_path = device_tree.FindDevicesWithTask()
            task_proxy = STORAGE.get_proxy(task_path)
            sync_run_task(task_proxy)
        except DBusError as e:
            # Does the user want to retry?
            if error_handler.cb(e) == ERROR_RAISE:
                raise
            # Retry populating the device tree.
            else:
                continue
        else:
            # No need to retry.
            break
Exemple #27
0
 def _sync_run_test(self):
     with pytest.raises(TaskFailedException):
         sync_run_task(self.task_interface)
Exemple #28
0
def exitHandler(rebootData):
    # Clear the list of watched PIDs.
    from pyanaconda.core.process_watchers import WatchProcesses
    WatchProcesses.unwatch_all_processes()

    if flags.usevnc:
        vnc.shutdownServer()

    if "nokill" in kernel_arguments:
        util.vtActivate(1)
        print("anaconda halting due to nokill flag.")
        print("The system will be rebooted when you press Ctrl-Alt-Delete.")
        while True:
            time.sleep(10000)

    if anaconda.dbus_inhibit_id:
        from pyanaconda.screensaver import uninhibit_screensaver
        uninhibit_screensaver(anaconda.dbus_session_connection, anaconda.dbus_inhibit_id)
        anaconda.dbus_inhibit_id = None

    # Unsetup the payload, which most usefully unmounts live images
    if anaconda.payload:
        anaconda.payload.unsetup()

    # Collect all optical media.
    from pyanaconda.modules.common.constants.objects import DEVICE_TREE
    from pyanaconda.modules.common.structures.storage import DeviceData
    device_tree = STORAGE.get_proxy(DEVICE_TREE)
    optical_media = []

    for device_name in device_tree.FindOpticalMedia():
        device_data = DeviceData.from_structure(
            device_tree.GetDeviceData(device_name)
        )
        optical_media.append(device_data.path)

    # Tear down the storage module.
    storage_proxy = STORAGE.get_proxy()

    for task_path in storage_proxy.TeardownWithTasks():
        task_proxy = STORAGE.get_proxy(task_path)
        sync_run_task(task_proxy)

    # Stop the DBus session.
    anaconda.dbus_launcher.stop()

    # Clean up the PID file
    if pidfile:
        pidfile.close()

    # Reboot the system.
    if conf.system.can_reboot:
        from pykickstart.constants import KS_SHUTDOWN, KS_WAIT

        if flags.eject or rebootData.eject:
            for device_path in optical_media:
                if util.get_mount_paths(device_path):
                    util.dracut_eject(device_path)

        if flags.kexec:
            util.execWithRedirect("systemctl", ["--no-wall", "kexec"])
            while True:
                time.sleep(10000)
        elif rebootData.action == KS_SHUTDOWN:
            util.execWithRedirect("systemctl", ["--no-wall", "poweroff"])
        elif rebootData.action == KS_WAIT:
            util.execWithRedirect("systemctl", ["--no-wall", "halt"])
        else:  # reboot action is KS_REBOOT or None
            util.execWithRedirect("systemctl", ["--no-wall", "reboot"])
Exemple #29
0
    services_proxy = SERVICES.get_proxy()

    if services_proxy.SetupOnBoot == SETUP_ON_BOOT_DEFAULT:
        if  not flags.automatedInstall:
            # Enable by default for interactive installations.
            services_proxy.SetSetupOnBoot(SETUP_ON_BOOT_ENABLED)

    # Create pre-install snapshots
    from pykickstart.constants import SNAPSHOT_WHEN_PRE_INSTALL
    from pyanaconda.kickstart import check_kickstart_error
    from pyanaconda.modules.common.constants.objects import SNAPSHOT
    from pyanaconda.modules.common.task import sync_run_task
    snapshot_proxy = STORAGE.get_proxy(SNAPSHOT)

    if snapshot_proxy.IsRequested(SNAPSHOT_WHEN_PRE_INSTALL):
        # What for the storage to load devices.
        # FIXME: Don't block the main thread!
        threadMgr.wait(constants.THREAD_STORAGE)

        # Run the task.
        snapshot_task_path = snapshot_proxy.CreateWithTask(SNAPSHOT_WHEN_PRE_INSTALL)
        snapshot_task_proxy = STORAGE.get_proxy(snapshot_task_path)

        with check_kickstart_error():
            sync_run_task(snapshot_task_proxy)

    anaconda.intf.setup(ksdata)
    anaconda.intf.run()

# vim:tw=78:ts=4:et:sw=4
 def _sync_run_test(self):
     with self.assertRaises(TaskFailedException):
         sync_run_task(self.task_interface)
Exemple #31
0
    def _apply(self):
        # Do not execute sections that were part of the original
        # anaconda kickstart file (== have .seen flag set)

        log.info("applying changes")

        services_proxy = SERVICES.get_proxy()
        reconfig_mode = services_proxy.SetupOnBoot == SETUP_ON_BOOT_RECONFIG

        # data.selinux
        # data.firewall

        # Configure the timezone.
        timezone_proxy = TIMEZONE.get_proxy()
        for task_path in timezone_proxy.InstallWithTasks():
            task_proxy = TIMEZONE.get_proxy(task_path)
            sync_run_task(task_proxy)

        # Configure the localization.
        localization_proxy = LOCALIZATION.get_proxy()
        for task_path in localization_proxy.InstallWithTasks():
            task_proxy = LOCALIZATION.get_proxy(task_path)
            sync_run_task(task_proxy)

        # Configure persistent hostname
        network_proxy = NETWORK.get_proxy()
        network_task = network_proxy.ConfigureHostnameWithTask(True)
        task_proxy = NETWORK.get_proxy(network_task)
        sync_run_task(task_proxy)
        # Set current hostname
        network_proxy.SetCurrentHostname(network_proxy.Hostname)

        # Configure groups, users & root account
        #
        # NOTE: We only configure groups, users & root account if the respective
        #       kickstart commands are *not* seen in the input kickstart.
        #       This basically means that we will configure only what was
        #       set in the Initial Setup UI and will not attempt to configure
        #       anything that looks like it was configured previously in
        #       the Anaconda UI or installation kickstart.
        users_proxy = USERS.get_proxy()

        if self._groups_already_configured and not reconfig_mode:
            log.debug("skipping user group configuration - already configured")
        elif users_proxy.Groups:  # only run of there are some groups to create
            groups_task = users_proxy.ConfigureGroupsWithTask()
            task_proxy = USERS.get_proxy(groups_task)
            log.debug("configuring user groups via %s task", task_proxy.Name)
            sync_run_task(task_proxy)

        if self._users_already_configured and not reconfig_mode:
            log.debug("skipping user configuration - already configured")
        elif users_proxy.Users:  # only run if there are some users to create
            users_task = users_proxy.ConfigureUsersWithTask()
            task_proxy = USERS.get_proxy(users_task)
            log.debug("configuring users via %s task", task_proxy.Name)
            sync_run_task(task_proxy)

        if self._root_password_already_configured and not reconfig_mode:
            log.debug(
                "skipping root password configuration - already configured")
        else:
            root_task = users_proxy.SetRootPasswordWithTask()
            task_proxy = USERS.get_proxy(root_task)
            log.debug("configuring root password via %s task", task_proxy.Name)
            sync_run_task(task_proxy)

        # Configure all addons
        log.info("executing addons")
        self.data.addons.execute(storage=None,
                                 ksdata=self.data,
                                 users=None,
                                 payload=None)

        boss_proxy = BOSS.get_proxy()
        task_path = boss_proxy.InstallSystemWithTask()
        task_proxy = BOSS.get_proxy(task_path)
        sync_run_task(task_proxy)

        if self.external_reconfig:
            # prevent the reconfig flag from being written out
            # to kickstart if neither /etc/reconfigSys or /.unconfigured
            # are present
            services_proxy = SERVICES.get_proxy()
            services_proxy.SetSetupOnBoot(SETUP_ON_BOOT_DEFAULT)

        # Write the kickstart data to file
        log.info("writing the Initial Setup kickstart file %s",
                 OUTPUT_KICKSTART_PATH)
        with open(OUTPUT_KICKSTART_PATH, "w") as f:
            f.write(str(self.data))
        log.info("finished writing the Initial Setup kickstart file")

        # Remove the reconfig files, if any - otherwise the reconfig mode
        # would start again next time the Initial Setup service is enabled.
        if self.external_reconfig:
            for reconfig_file in RECONFIG_FILES:
                if os.path.exists(reconfig_file):
                    log.debug("removing reconfig trigger file: %s" %
                              reconfig_file)
                    os.remove(reconfig_file)

        # and we are done with applying changes
        log.info("all changes have been applied")
Exemple #32
0
 def configure_bootloader():
     boot_task = bootloader_proxy.ConfigureWithTask(
         payload.kernel_version_list)
     sync_run_task(STORAGE.get_proxy(boot_task))
Exemple #33
0
 def execute(self):
     localization_proxy = LOCALIZATION.get_proxy()
     task_path = localization_proxy.InstallLanguageWithTask(util.getSysroot())
     task_proxy = LOCALIZATION.get_proxy(task_path)
     sync_run_task(task_proxy)
 def _start_modules(self):
     """Start the kickstart modules."""
     boss_proxy = BOSS.get_proxy()
     task_path = boss_proxy.StartModulesWithTask()
     task_proxy = BOSS.get_proxy(task_path)
     sync_run_task(task_proxy)
Exemple #35
0
 def _sync_run_test(self):
     with self.assertRaises(TaskFailedException):
         sync_run_task(self.task_interface)