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/systemctl | |
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/systemctl')
-rw-r--r-- | src/systemctl/systemctl.c | 34 |
1 files changed, 4 insertions, 30 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index 060bfe28e4..a6c7e91f54 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -1951,32 +1951,6 @@ static void dump_unit_file_changes(const UnitFileChange *changes, unsigned n_cha } } -static int deserialize_and_dump_unit_file_changes(sd_bus_message *m) { - 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 (!arg_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; -} - static int set_default(sd_bus *bus, char **args) { _cleanup_free_ char *unit = NULL; UnitFileChange *changes = NULL; @@ -2024,7 +1998,7 @@ static int set_default(sd_bus *bus, char **args) { return r; } - r = deserialize_and_dump_unit_file_changes(reply); + r = bus_deserialize_and_dump_unit_file_changes(reply, arg_quiet); if (r < 0) return r; @@ -5389,7 +5363,7 @@ static int enable_unit(sd_bus *bus, char **args) { return bus_log_parse_error(r); } - r = deserialize_and_dump_unit_file_changes(reply); + r = bus_deserialize_and_dump_unit_file_changes(reply, arg_quiet); if (r < 0) return r; @@ -5488,7 +5462,7 @@ static int add_dependency(sd_bus *bus, char **args) { return r; } - r = deserialize_and_dump_unit_file_changes(reply); + r = bus_deserialize_and_dump_unit_file_changes(reply, arg_quiet); if (r < 0) return r; @@ -5552,7 +5526,7 @@ static int preset_all(sd_bus *bus, char **args) { return r; } - r = deserialize_and_dump_unit_file_changes(reply); + r = bus_deserialize_and_dump_unit_file_changes(reply, arg_quiet); if (r < 0) return r; |