diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-07-03 17:50:55 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-07-03 17:54:24 +0200 |
commit | 717603e391b52983ca1fd218e7333a1b9dfc5c05 (patch) | |
tree | 1a4da5a932aeaa9da207d46e4f71b8bc566e2c27 /src/machine/machined-dbus.c | |
parent | 98be1a746ac0d7a17e69ccb05936a4d6b3223e97 (diff) |
machinectl: show /etc/os-release information of container in status output
Diffstat (limited to 'src/machine/machined-dbus.c')
-rw-r--r-- | src/machine/machined-dbus.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/machine/machined-dbus.c b/src/machine/machined-dbus.c index 7c1802ce2a..ffcd7c026a 100644 --- a/src/machine/machined-dbus.c +++ b/src/machine/machined-dbus.c @@ -371,6 +371,27 @@ static int method_get_machine_addresses(sd_bus *bus, sd_bus_message *message, vo return bus_machine_method_get_addresses(bus, message, machine, error); } +static int method_get_machine_os_release(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) { + Manager *m = userdata; + Machine *machine; + const char *name; + int r; + + assert(bus); + assert(message); + assert(m); + + r = sd_bus_message_read(message, "s", &name); + if (r < 0) + return sd_bus_error_set_errno(error, r); + + machine = hashmap_get(m->machines, name); + if (!machine) + return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_MACHINE, "No machine '%s' known", name); + + return bus_machine_method_get_os_release(bus, message, machine, error); +} + const sd_bus_vtable manager_vtable[] = { SD_BUS_VTABLE_START(0), SD_BUS_METHOD("GetMachine", "s", "o", method_get_machine, SD_BUS_VTABLE_UNPRIVILEGED), @@ -381,6 +402,7 @@ const sd_bus_vtable manager_vtable[] = { SD_BUS_METHOD("KillMachine", "ssi", NULL, method_kill_machine, SD_BUS_VTABLE_CAPABILITY(CAP_KILL)), SD_BUS_METHOD("TerminateMachine", "s", NULL, method_terminate_machine, SD_BUS_VTABLE_CAPABILITY(CAP_KILL)), SD_BUS_METHOD("GetMachineAddresses", "s", "a(yay)", method_get_machine_addresses, SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD("GetMachineOSRelease", "s", "a{ss}", method_get_machine_os_release, SD_BUS_VTABLE_UNPRIVILEGED), SD_BUS_SIGNAL("MachineNew", "so", 0), SD_BUS_SIGNAL("MachineRemoved", "so", 0), SD_BUS_VTABLE_END |