diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-12-29 14:05:17 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-12-29 17:00:05 +0100 |
commit | d8f52ed25a9edce75fda5251c977b7898e33887e (patch) | |
tree | 6d3fb43dda2d5e3e8d543b0440466de9d9ce0f1c /src/libsystemd/sd-bus | |
parent | ebd011d95b61a86258dece9864f65b7c4af721c0 (diff) |
machinectl: add "enable" and "disable" verbs for enabling/disabling systemd-nspawn for containers
This is basically just a shortcut for "systemctl enable
systemd-nspawn@<foobar>.service", but does escaping.
Diffstat (limited to 'src/libsystemd/sd-bus')
-rw-r--r-- | src/libsystemd/sd-bus/bus-util.c | 26 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/bus-util.h | 2 |
2 files changed, 28 insertions, 0 deletions
diff --git a/src/libsystemd/sd-bus/bus-util.c b/src/libsystemd/sd-bus/bus-util.c index c264f2d3fd..29520f95d2 100644 --- a/src/libsystemd/sd-bus/bus-util.c +++ b/src/libsystemd/sd-bus/bus-util.c @@ -1776,3 +1776,29 @@ int bus_wait_for_jobs_add(BusWaitForJobs *d, const char *path) { return set_put_strdup(d->jobs, path); } + +int bus_deserialize_and_dump_unit_file_changes(sd_bus_message *m, bool quiet) { + const char *type, *path, *source; + int r; + + r = sd_bus_message_enter_container(m, SD_BUS_TYPE_ARRAY, "(sss)"); + if (r < 0) + return bus_log_parse_error(r); + + while ((r = sd_bus_message_read(m, "(sss)", &type, &path, &source)) > 0) { + if (!quiet) { + if (streq(type, "symlink")) + log_info("Created symlink from %s to %s.", path, source); + else + log_info("Removed symlink %s.", path); + } + } + if (r < 0) + return bus_log_parse_error(r); + + r = sd_bus_message_exit_container(m); + if (r < 0) + return bus_log_parse_error(r); + + return 0; +} diff --git a/src/libsystemd/sd-bus/bus-util.h b/src/libsystemd/sd-bus/bus-util.h index 31e7fadbb6..e8a97cef9e 100644 --- a/src/libsystemd/sd-bus/bus-util.h +++ b/src/libsystemd/sd-bus/bus-util.h @@ -210,3 +210,5 @@ int bus_wait_for_jobs_add(BusWaitForJobs *d, const char *path); int bus_wait_for_jobs(BusWaitForJobs *d, bool quiet); DEFINE_TRIVIAL_CLEANUP_FUNC(BusWaitForJobs*, bus_wait_for_jobs_free); + +int bus_deserialize_and_dump_unit_file_changes(sd_bus_message *m, bool quiet); |