Skip to content

How to use SetProperties ? #122

Description

@flesueur

Dear pystemd team,

With CLI, I can run this command to update /sys/fs/cgroup/system.slice/cpu.weight (just an example) :

# gdbus call --system --dest org.freedesktop.systemd1 --object-path /org/freedesktop/systemd1/unit/system_2eslice --method org.freedesktop.systemd1.Unit.SetProperties true "[('CPUWeight', <@t 200>)]"
()

But with pystemd, I cannot find how to do this. I tried :

>>> my = pystemd.systemd1.Unit("system.slice")
>>> my.load()
>>> my.Unit.SetProperties(True, [(b"CPUWeight", 200)])
...
TypeError: expected bytes, int found for input "100", element number 4 in input series:
...
>>> my.Unit.SetProperties(True, [(b"CPUWeight", b"200")])
...
pystemd.dbusexc.DBusInconsistentMessageError: [err -74]: b'Bad message'
...

I cannot find a higher level function, nor how to instantiate a 't' type for the VARIANT type expected as parameter.

Cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions