Exemplo n.º 1
0
    def add_addon_modules(self):
        """Add the addon modules."""
        dbus = DBus.get_dbus_proxy()
        names = dbus.ListActivatableNames()

        for name in names:
            if name.startswith(DBUS_ADDON_NAMESPACE):
                self.add_module(name, auto_object_path(name))
Exemplo n.º 2
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)
Exemplo n.º 3
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)
Exemplo n.º 4
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
Exemplo n.º 5
0
    def __setitem__(self, k: str, v: U) -> None:
        if k in self._dict.keys():
            raise KeyError("Objects in PublishableGroup cannot be overridden.")
        bus_path = auto_object_path(self._bus_path, k).replace('-', '_')

        try:
            registration = self._bus.register_object(bus_path, v, None)

            published_object = PublishedObject(
                bus_path=bus_path,
                registration=registration,
                object=v,
            )

            self._dict[k] = published_object
        except GLib.Error as e:
            raise ValueError("Unable to publish the object on DBus.") from e
Exemplo n.º 6
0
def construct(self, introspection_et, bus_name, object_path=None):
    """Construct proxy for remote object.

    This works exactly like .get() but constructs the proxy
    from static introspection provided as additional parameter

    In contrast to .get() the dbus object does not need to exist on the bus and
    the introspection data can be cached by the application or statically be provided

    Parameters
    ----------
    introspection_et : ElementTree node object containing introspection data

    >>> from xml.etree import ElementTree as ET
    >>> intro = ET.fromstring(SystemBus().get('org.bluez').Introspect()[0])
    >>> o = SystemBus.get(intro, 'org.bluez')

    """
    bus_name = auto_bus_name(bus_name)
    object_path = auto_object_path(bus_name, object_path)
    ci = CompositeInterface(introspection_et)(self, bus_name, object_path)
    backfill_async_dbus_methods(ci, introspection_et)
    return ci
Exemplo n.º 7
0
#

from pydbus.auto_names import auto_object_path

# main Anaconda DBUS namespace
ANACONDA_DBUS_NAMESPACE = "org.fedoraproject.Anaconda"

# DBUS namespace for modules
DBUS_MODULE_NAMESPACE = "{}.Modules".format(ANACONDA_DBUS_NAMESPACE)

# DBUS namespace for addons
DBUS_ADDON_NAMESPACE = "{}.Addons".format(ANACONDA_DBUS_NAMESPACE)

# BOSS
DBUS_BOSS_NAME = "{}.Boss".format(ANACONDA_DBUS_NAMESPACE)
DBUS_BOSS_PATH = auto_object_path(DBUS_BOSS_NAME)

DBUS_BOSS_INSTALLATION_NAME = "{}.Installation".format(DBUS_BOSS_NAME)
DBUS_BOSS_INSTALLATION_PATH = auto_object_path(DBUS_BOSS_INSTALLATION_NAME)

# Temporary interface for anaconda
DBUS_BOSS_ANACONDA_NAME = "{}.Anaconda".format(DBUS_BOSS_NAME)

# Anaconda DBUS modules
MODULE_FOO_NAME = "{}.Foo".format(DBUS_MODULE_NAMESPACE)
MODULE_FOO_PATH = auto_object_path(MODULE_FOO_NAME)

MODULE_BAR_NAME = "{}.Bar".format(DBUS_MODULE_NAMESPACE)
MODULE_BAR_PATH = auto_object_path(MODULE_BAR_NAME)

MODULE_TIMEZONE_NAME = "{}.Timezone".format(DBUS_MODULE_NAMESPACE)