Пример #1
0
    def publish(self):
        """Publish the module."""
        TaskContainer.set_namespace(NETWORK.namespace)
        self._firewall_module.publish()

        DBus.publish_object(NETWORK.object_path, NetworkInterface(self))
        DBus.register_service(NETWORK.service_name)
Пример #2
0
    def publish(self):
        """Publish the module."""
        TaskContainer.set_namespace(PAYLOADS.namespace)

        self._packages.publish()

        DBus.publish_object(PAYLOADS.object_path, PayloadsInterface(self))
        DBus.register_service(PAYLOADS.service_name)
Пример #3
0
    def publish(self):
        """Publish the boss."""
        TaskContainer.set_namespace(BOSS.namespace)

        # Publish submodules.
        self._ui_module.publish()

        DBus.publish_object(BOSS.object_path, BossInterface(self))
        DBus.register_service(BOSS.service_name)
Пример #4
0
    def publish(self):
        """Publish the module."""
        TaskContainer.set_namespace(STORAGE.namespace)

        for kickstart_module in self._modules:
            kickstart_module.publish()

        DBus.publish_object(STORAGE.object_path, StorageInterface(self))
        DBus.register_service(STORAGE.service_name)
Пример #5
0
    def _collect_tasks(self, collector):
        """Collect installation tasks from modules.

        FIXME: This method temporarily uses only addons.

        :param collector: a function that returns a list of task paths for a proxy
        :return: a list of tasks proxies
        """
        tasks = []

        if not self._module_observers:
            log.error("Starting installation without available modules.")

        for observer in self._module_observers:
            # FIXME: This check is here for testing purposes only.
            # Normally, all given modules should be available once
            # we start the installation.
            if not observer.is_service_available:
                log.error("Module %s is not available!", observer.service_name)
                continue

            # FIXME: Enable for all modules.
            if not observer.is_addon:
                continue

            service_name = observer.service_name
            task_paths = collector(observer.proxy)

            for object_path in task_paths:
                log.debug("Getting task %s from module %s", object_path,
                          service_name)
                task_proxy = DBus.get_proxy(service_name, object_path)
                tasks.append(task_proxy)

        return tasks
Пример #6
0
 def stop(self):
     """Stop the loop."""
     DBus.disconnect()
     Timer().timeout_sec(1, self.loop.quit)
 def publish(self):
     """Publish the module."""
     TaskContainer.set_namespace(HELLO_WORLD.namespace)
     DBus.publish_object(HELLO_WORLD.object_path, HelloWorldInterface(self))
     DBus.register_service(HELLO_WORLD.service_name)
Пример #8
0
 def publish(self):
     """Publish the module."""
     TaskContainer.set_namespace(SECURITY.namespace)
     DBus.publish_object(SECURITY.object_path, SecurityInterface(self))
     DBus.register_service(SECURITY.service_name)
Пример #9
0
def _prepare_installation(payload, ksdata):
    """Perform an installation.  This method takes the ksdata as prepared by
       the UI (the first hub, in graphical mode) and applies it to the disk.
       The two main tasks for this are putting filesystems onto disks and
       installing packages onto those filesystems.
    """
    installation_queue = TaskQueue("Installation queue")
    # connect progress reporting
    installation_queue.queue_started.connect(
        lambda x: progress_message(x.status_message))
    installation_queue.task_completed.connect(lambda x: progress_step(x.name))

    # This should be the only thread running, wait for the others to finish if not.
    if threadMgr.running > 1:
        # it could be that the threads finish execution before the task is executed,
        # but that should not cause any issues

        def wait_for_all_treads():
            for message in ("Thread %s is running" % n
                            for n in threadMgr.names):
                log.debug(message)
            threadMgr.wait_all()

        # Use a queue with a single task as only TaskQueues have the status_message
        # property used for setting the progress status in the UI.
        wait_for_threads = TaskQueue(
            "Wait for threads to finish",
            N_("Waiting for %s threads to finish") % (threadMgr.running - 1))

        wait_for_threads.append(
            Task("Wait for all threads to finish", wait_for_all_treads))
        installation_queue.append(wait_for_threads)

    # Save system time to HW clock.
    # - this used to be before waiting on threads, but I don't think that's needed
    if conf.system.can_set_hardware_clock:
        # lets just do this as a top-level task - no
        save_hwclock = Task("Save system time to HW clock",
                            timezone.save_hw_clock)
        installation_queue.append(save_hwclock)

    # setup the installation environment
    setup_environment = TaskQueue(
        "Installation environment setup",
        N_("Setting up the installation environment"))

    boss_proxy = BOSS.get_proxy()
    for service_name, object_path in boss_proxy.CollectConfigureRuntimeTasks():
        task_proxy = DBus.get_proxy(service_name, object_path)
        setup_environment.append(DBusTask(task_proxy))

    installation_queue.append(setup_environment)

    # Do partitioning.
    # Depending on current payload the storage might be apparently configured
    # either before or after package/payload installation.
    # So let's have two task queues - early storage & late storage.
    storage_proxy = STORAGE.get_proxy()
    early_storage = TaskQueue("Early storage configuration",
                              N_("Configuring storage"))
    early_storage.append_dbus_tasks(STORAGE, storage_proxy.InstallWithTasks())

    if payload.type == PAYLOAD_TYPE_DNF:
        conf_task = storage_proxy.WriteConfigurationWithTask()
        early_storage.append_dbus_tasks(STORAGE, [conf_task])

    installation_queue.append(early_storage)

    # Run %pre-install scripts with the filesystem mounted and no packages
    pre_install_scripts = TaskQueue("Pre-install scripts",
                                    N_("Running pre-installation scripts"))
    pre_install_scripts.append(
        Task("Run %pre-install scripts", runPreInstallScripts,
             (ksdata.scripts, )))
    installation_queue.append(pre_install_scripts)

    # Do various pre-installation tasks
    # - try to discover a realm (if any)
    # - check for possibly needed additional packages.
    pre_install = TaskQueue("Pre install tasks",
                            N_("Running pre-installation tasks"))

    # make name resolution work for rpm scripts in chroot
    if conf.system.provides_resolver_config:
        # we use a custom Task subclass as the sysroot path has to be resolved
        # only when the task is actually started, not at task creation time
        pre_install.append(WriteResolvConfTask("Copy resolv.conf to sysroot"))

    if is_module_available(SECURITY):
        security_proxy = SECURITY.get_proxy()

        # Discover a realm.
        pre_install.append_dbus_tasks(SECURITY,
                                      [security_proxy.DiscoverRealmWithTask()])

        # Set up FIPS for the payload installation.
        fips_task = security_proxy.PreconfigureFIPSWithTask(payload.type)
        pre_install.append_dbus_tasks(SECURITY, [fips_task])

    # Install the payload.
    pre_install.append(
        Task("Find additional packages & run pre_install()",
             payload.pre_install))
    installation_queue.append(pre_install)

    payload_install = TaskQueue("Payload installation", N_("Installing."))
    payload_install.append(Task("Install the payload", payload.install))
    installation_queue.append(payload_install)

    # for some payloads storage is configured after the payload is installed
    if payload.type != PAYLOAD_TYPE_DNF:
        late_storage = TaskQueue("Late storage configuration",
                                 N_("Configuring storage"))
        conf_task = storage_proxy.WriteConfigurationWithTask()
        late_storage.append_dbus_tasks(STORAGE, [conf_task])
        installation_queue.append(late_storage)

    # Do bootloader.
    bootloader_proxy = STORAGE.get_proxy(BOOTLOADER)
    bootloader_install = TaskQueue("Bootloader installation",
                                   N_("Installing boot loader"))

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

    bootloader_install.append(
        Task("Install bootloader", run_install_bootloader))
    installation_queue.append(bootloader_install)

    post_install = TaskQueue("Post-installation setup tasks",
                             (N_("Performing post-installation setup tasks")))
    post_install.append(
        Task("Run post-installation setup tasks", payload.post_install))
    installation_queue.append(post_install)

    # Create snapshot
    snapshot_proxy = STORAGE.get_proxy(SNAPSHOT)

    if snapshot_proxy.IsRequested(SNAPSHOT_WHEN_POST_INSTALL):
        snapshot_creation = TaskQueue("Creating post installation snapshots",
                                      N_("Creating snapshots"))
        snapshot_task = snapshot_proxy.CreateWithTask(
            SNAPSHOT_WHEN_POST_INSTALL)
        snapshot_creation.append_dbus_tasks(STORAGE, [snapshot_task])
        installation_queue.append(snapshot_creation)

    return installation_queue
Пример #10
0
 def publish(self):
     """Publish the module."""
     DBus.publish_object(DISK_INITIALIZATION.object_path,
                         DiskInitializationInterface(self))
Пример #11
0
 def publish(self):
     """Publish the module."""
     TaskContainer.set_namespace(USERS.namespace)
     DBus.publish_object(USERS.object_path, UsersInterface(self))
     DBus.register_service(USERS.service_name)
Пример #12
0
 def publish(self):
     """Publish the module."""
     DBus.publish_object(SNAPSHOT.object_path, SnapshotInterface(self))
Пример #13
0
 def publish(self):
     """Publish the module."""
     TaskContainer.set_namespace(BAZ.namespace)
     DBus.publish_object(BAZ.object_path, BazInterface(self))
     DBus.register_service(BAZ.service_name)
Пример #14
0
 def publish(self):
     """Publish the module."""
     DBus.publish_object(USER_INTERFACE.object_path, UIInterface(self))
Пример #15
0
 def publish(self):
     """Publish the DBus objects."""
     TaskContainer.set_namespace(KDUMP.namespace)
     DBus.publish_object(KDUMP.object_path, KdumpInterface(self))
     DBus.register_service(KDUMP.service_name)
Пример #16
0
 def publish(self):
     """Publish the module."""
     DBus.publish_object(FCOE.object_path, FCOEInterface(self))
Пример #17
0
    def run_configure_bootloader():
        tasks = boss_proxy.CollectConfigureBootloaderTasks(
            payload.kernel_version_list)

        for service, task in tasks:
            sync_run_task(DBus.get_proxy(service, task))
Пример #18
0
 def publish(self):
     """Publish the module."""
     DBus.publish_object(DASD.object_path, DASDInterface(self))
Пример #19
0
 def publish(self):
     """Publish the module."""
     DBus.publish_object(AUTO_PARTITIONING.object_path,
                         self.for_publication())
Пример #20
0
 def publish(self):
     """Publish the module."""
     DBus.publish_object(PAYLOAD_PACKAGES.object_path,
                         PackagesInterface(self))
Пример #21
0
 def publish(self):
     """Publish the module."""
     DBus.publish_object(DISK_SELECTION.object_path,
                         DiskSelectionInterface(self))
Пример #22
0
 def publish(self):
     """Publish the module."""
     DBus.publish_object(ISCSI.object_path, ISCSIInterface(self))
Пример #23
0
 def publish(self):
     """Publish the module."""
     DBus.publish_object(ZFCP.object_path, ZFCPInterface(self))
Пример #24
0
 def publish(self):
     """Publish the module."""
     DBus.publish_object(FIREWALL.object_path, FirewallInterface(self))
Пример #25
0
 def publish(self):
     """Publish the module."""
     DBus.publish_object(NVDIMM.object_path, NVDIMMInterface(self))
Пример #26
0
 def publish(self):
     """Publish the module."""
     DBus.publish_object(BOOTLOADER.object_path, BootloaderInterface(self))
Пример #27
0
def _prepare_configuration(payload, ksdata):
    """Configure the installed system."""

    configuration_queue = TaskQueue("Configuration queue")
    # connect progress reporting
    configuration_queue.queue_started.connect(
        lambda x: progress_message(x.status_message))
    configuration_queue.task_completed.connect(lambda x: progress_step(x.name))

    # add installation tasks for the Subscription DBus module
    if is_module_available(SUBSCRIPTION):
        # we only run the tasks if the Subscription module is available
        subscription_config = TaskQueue("Subscription configuration",
                                        N_("Configuring Red Hat subscription"))
        subscription_proxy = SUBSCRIPTION.get_proxy()
        subscription_dbus_tasks = subscription_proxy.InstallWithTasks()
        subscription_config.append_dbus_tasks(SUBSCRIPTION,
                                              subscription_dbus_tasks)
        configuration_queue.append(subscription_config)

    # schedule the execute methods of ksdata that require an installed system to be present
    os_config = TaskQueue("Installed system configuration",
                          N_("Configuring installed system"))

    # add installation tasks for the Security DBus module
    if is_module_available(SECURITY):
        security_proxy = SECURITY.get_proxy()
        security_dbus_tasks = security_proxy.InstallWithTasks()
        os_config.append_dbus_tasks(SECURITY, security_dbus_tasks)

    # add installation tasks for the Timezone DBus module
    # run these tasks before tasks of the Services module
    if is_module_available(TIMEZONE):
        timezone_proxy = TIMEZONE.get_proxy()
        timezone_dbus_tasks = timezone_proxy.InstallWithTasks()
        os_config.append_dbus_tasks(TIMEZONE, timezone_dbus_tasks)

    # add installation tasks for the Services DBus module
    if is_module_available(SERVICES):
        services_proxy = SERVICES.get_proxy()
        services_dbus_tasks = services_proxy.InstallWithTasks()
        os_config.append_dbus_tasks(SERVICES, services_dbus_tasks)

    # add installation tasks for the Localization DBus module
    if is_module_available(LOCALIZATION):
        localization_proxy = LOCALIZATION.get_proxy()
        localization_dbus_tasks = localization_proxy.InstallWithTasks()
        os_config.append_dbus_tasks(LOCALIZATION, localization_dbus_tasks)

    # add the Firewall configuration task
    if conf.target.can_configure_network:
        firewall_proxy = NETWORK.get_proxy(FIREWALL)
        firewall_dbus_task = firewall_proxy.InstallWithTask()
        os_config.append_dbus_tasks(NETWORK, [firewall_dbus_task])

    configuration_queue.append(os_config)

    # schedule network configuration (if required)
    if conf.target.can_configure_network and conf.system.provides_network_config:
        overwrite = payload.type in PAYLOAD_LIVE_TYPES
        network_config = TaskQueue("Network configuration",
                                   N_("Writing network configuration"))
        network_config.append(
            Task("Network configuration", network.write_configuration,
                 (overwrite, )))
        configuration_queue.append(network_config)

    # add installation tasks for the Users DBus module
    if is_module_available(USERS):
        user_config = TaskQueue("User creation", N_("Creating users"))
        users_proxy = USERS.get_proxy()
        users_dbus_tasks = users_proxy.InstallWithTasks()
        user_config.append_dbus_tasks(USERS, users_dbus_tasks)
        configuration_queue.append(user_config)

    # Anaconda addon configuration
    addon_config = TaskQueue("Anaconda addon configuration",
                             N_("Configuring addons"))

    boss_proxy = BOSS.get_proxy()
    for service_name, object_path in boss_proxy.CollectInstallSystemTasks():
        task_proxy = DBus.get_proxy(service_name, object_path)
        addon_config.append(DBusTask(task_proxy))

    configuration_queue.append(addon_config)

    # Initramfs generation
    generate_initramfs = TaskQueue("Initramfs generation",
                                   N_("Generating initramfs"))
    bootloader_proxy = STORAGE.get_proxy(BOOTLOADER)

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

    generate_initramfs.append(
        Task("Generate initramfs", run_generate_initramfs))
    configuration_queue.append(generate_initramfs)

    if is_module_available(SECURITY):
        security_proxy = SECURITY.get_proxy()

        # Configure FIPS.
        configuration_queue.append_dbus_tasks(
            SECURITY, [security_proxy.ConfigureFIPSWithTask()])

        # Join a realm. This can run only after network is configured in the target system chroot.
        configuration_queue.append_dbus_tasks(
            SECURITY, [security_proxy.JoinRealmWithTask()])

    post_scripts = TaskQueue("Post installation scripts",
                             N_("Running post-installation scripts"))
    post_scripts.append(
        Task("Run post installation scripts", runPostScripts,
             (ksdata.scripts, )))
    configuration_queue.append(post_scripts)

    # setup kexec reboot if requested
    if flags.flags.kexec:
        kexec_setup = TaskQueue("Kexec setup", N_("Setting up kexec"))
        kexec_setup.append(Task("Setup kexec", setup_kexec))
        configuration_queue.append(kexec_setup)

    # write anaconda related configs & kickstarts
    write_configs = TaskQueue("Write configs and kickstarts",
                              N_("Storing configuration files and kickstarts"))

    # Write the kickstart file to the installed system (or, copy the input
    # kickstart file over if one exists).
    if flags.flags.nosave_output_ks:
        # don't write the kickstart file to the installed system if this has
        # been disabled by the nosave option
        log.warning(
            "Writing of the output kickstart to installed system has been disabled"
            " by the nosave option.")
    else:
        # write anaconda related configs & kickstarts
        write_configs.append(Task("Store kickstarts", _writeKS, (ksdata, )))

    # only add write_configs to the main queue if we actually store some kickstarts/configs
    if write_configs.task_count:
        configuration_queue.append(write_configs)

    return configuration_queue
Пример #28
0
 def publish(self):
     """Publish the module."""
     TaskContainer.set_namespace(TIMEZONE.namespace)
     DBus.publish_object(TIMEZONE.object_path, TimezoneInterface(self))
     DBus.register_service(TIMEZONE.service_name)
Пример #29
0
 def publish(self):
     """Publish the module."""
     TaskContainer.set_namespace(SUBSCRIPTION.namespace)
     DBus.publish_object(SUBSCRIPTION.object_path,
                         SubscriptionInterface(self))
     DBus.register_service(SUBSCRIPTION.service_name)
Пример #30
0
 def publish(self):
     """Publish the module."""
     TaskContainer.set_namespace(LOCALIZATION.namespace)
     DBus.publish_object(LOCALIZATION.object_path,
                         LocalizationInterface(self))
     DBus.register_service(LOCALIZATION.service_name)