Example #1
0
    def _collect_tasks(self):
        self._tasks.clear()

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

        for module_service in self._modules:
            # FIXME: This is just a temporary solution.
            module_object = DBus.get_proxy(module_service, auto_object_path(module_service))

            tasks = module_object.AvailableTasks()
            for task in tasks:
                log.debug("Getting task %s from module %s", task[TASK_NAME], module_service)
                task_proxy = DBus.get_proxy(module_service, task[TASK_PATH])
                self._tasks.add(task_proxy)
Example #2
0
    def _collect_installation_tasks(self):
        """Collect installation tasks from modules.

        :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

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

            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
Example #3
0
    def _collect_installation_tasks(self):
        """Collect installation tasks from modules.

        :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

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

            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
Example #4
0
def distribute_kickstart_with_boss(kickstart_path):
    boss = DBus.get_proxy(DBUS_BOSS_NAME, DBUS_BOSS_PATH)
    try:
        boss.SplitKickstart(kickstart_path)
    except SplitKickstartError as e:
        log.error("Boss.SplitKickstart(%s) exception: %s", kickstart_path, e)
        return False

    log.info("Boss.SplitKickstart(%s):\n%s", kickstart_path,
             boss.UnprocessedKickstart)

    timeout = 10
    while not boss.AllModulesAvailable and timeout > 0:
        log.info("Waiting %d sec for modules to be started", timeout)
        time.sleep(1)
        timeout = timeout - 1
    if not timeout:
        log.warning("Waiting for modules to be started timed out")
        return False

    errors = boss.DistributeKickstart()
    if errors:
        log.error("Boss.DistributeKickstart() errors: %s", errors)
    unprocessed_kickstart = boss.UnprocessedKickstart
    log.info("Boss.DistributeKickstart() unprocessed part:\n%s",
             unprocessed_kickstart)
    return True
Example #5
0
    def proxy(self):
        """"Returns a proxy of the remote object."""
        if not self._is_service_available:
            raise DBusObserverError("Service {} is not available.".format(
                self._service_name))

        if not self._proxy:
            self._proxy = DBus.get_proxy(self._service_name, self._object_path)

        return self._proxy
Example #6
0
    def get_proxy(self, object_path):
        """"Returns a proxy of the remote object."""
        if not self._is_service_available:
            raise DBusObserverError("Service {} is not available.".format(
                self._service_name))

        if object_path in self._proxies:
            return self._proxies.get(object_path)

        proxy = DBus.get_proxy(self._service_name, object_path)
        self._proxies[object_path] = proxy
        return proxy
Example #7
0
 def stop_modules(self):
     """Tells all running modules to quit."""
     log.debug("sending Quit to all modules and addons")
     for service in self.running_module_services:
         # FIXME: This is just a temporary solution.
         module = DBus.get_proxy(service, auto_object_path(service))
         # TODO: async ?
         # possible reasons:
         # - module hanging in Quit, deadlocking shutdown
         try:
             module.Quit()
         except Exception:  # pylint: disable=broad-except
             log.exception("Quit failed for module: %s", service)
Example #8
0
 def check_modules_started(self):
     if self.modules_starting_finished:
         log.debug("modules starting finished, running: %s failed: %s",
                   self._started_module_services,
                   self._failed_module_services)
         for service in self._started_module_services:
             # FIXME: This is just a temporary solution.
             module = DBus.get_proxy(service, auto_object_path(service))
             module.EchoString(
                 "Boss told me - some modules were started: %s and some might have failed: %s."
                 % (self._started_module_services,
                    self._failed_module_services))
         return True
     else:
         return False
Example #9
0
    def _collect_tasks(self):
        self._tasks.clear()

        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

            tasks = observer.proxy.AvailableTasks
            for task in tasks:
                log.debug("Getting task %s from module %s", task[TASK_NAME], observer.service_name)
                task_proxy = DBus.get_proxy(observer.service_name, task[TASK_PATH])
                self._tasks.add(task_proxy)