Exemplo n.º 1
0
    def SetUnitProperties(self, interface_name, unit_name, runtime,
                          properties):
        assert interface_name == b"org.freedesktop.systemd1.Manager"
        args = apply_signature(b"sb", [unit_name, runtime])

        args += signature_array(properties)

        with self.bus_context() as bus:
            return bus.call_method(self.destination, self.path, interface_name,
                                   b"SetUnitProperties", args).body
Exemplo n.º 2
0
    def StartTransientUnit(self,
                           interface_name,
                           name,
                           smode,
                           properties,
                           extra_units=None):
        assert interface_name == b"org.freedesktop.systemd1.Manager"

        args = apply_signature(b"ss", [name, smode])
        args += signature_array(properties)

        # extra units
        args += [(ord(b"a"), b"(sa(sv))")]
        for eu_name, eu_properties in extra_units or []:
            args += [(ord(b"r"), b"sa(sv)")]
            args += apply_signature(b"s", [eu_name])
            args += signature_array(eu_properties)
            args += [(-1, None)]

        args += [(-1, None)]

        with self.bus_context() as bus:
            return bus.call_method(self.destination, self.path, interface_name,
                                   b"StartTransientUnit", args).body