summaryrefslogtreecommitdiff
path: root/src/systemctl/systemctl.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-12-15 23:28:38 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-12-16 00:30:33 -0500
commit3f36991e00634026db3c603a10dfcb3af2c5b7b2 (patch)
tree2c9b4d9dd492af42bf4ad30650105f40a8f62b46 /src/systemctl/systemctl.c
parent5b013a2f67a5914d6e86e3914f40cf44a03da091 (diff)
systemctl: unify warning about unit files changed on disk
Diffstat (limited to 'src/systemctl/systemctl.c')
-rw-r--r--src/systemctl/systemctl.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 324d9b60c2..20bc3bdf1c 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -2270,6 +2270,14 @@ static int need_daemon_reload(sd_bus *bus, const char *unit) {
return b;
}
+static void warn_unit_file_changed(const char *name) {
+ log_warning("%sWarning:%s %s changed on disk. Run 'systemctl%s daemon-reload' to reload units.",
+ ansi_highlight_red(),
+ ansi_highlight_off(),
+ name,
+ arg_scope == UNIT_FILE_SYSTEM ? "" : " --user");
+}
+
typedef struct WaitData {
Set *set;
@@ -2676,8 +2684,7 @@ static int start_unit_one(
return bus_log_parse_error(r);
if (need_daemon_reload(bus, name) > 0)
- log_warning("Warning: Unit file of %s changed on disk, 'systemctl%s daemon-reload' recommended.",
- name, arg_scope == UNIT_FILE_SYSTEM ? "" : " --user");
+ warn_unit_file_changed(name);
if (s) {
char *p;
@@ -3606,10 +3613,7 @@ static void print_status_info(
}
if (i->need_daemon_reload)
- printf("\n%sWarning:%s Unit file changed on disk, 'systemctl %sdaemon-reload' recommended.\n",
- ansi_highlight_red(),
- ansi_highlight_off(),
- arg_scope == UNIT_FILE_SYSTEM ? "" : "--user ");
+ warn_unit_file_changed(i->id);
}
static void show_unit_help(UnitStatusInfo *i) {
@@ -4612,8 +4616,7 @@ static int cat(sd_bus *bus, char **args) {
return log_oom();
if (need_daemon_reload(bus, *name) > 0)
- log_warning("Unit file of %s changed on disk. Run 'systemctl%s daemon-reload'.",
- *name, arg_scope == UNIT_FILE_SYSTEM ? "" : " --user");
+ warn_unit_file_changed(*name);
r = sd_bus_get_property_string(
bus,
@@ -6055,8 +6058,7 @@ static int unit_find_path(sd_bus *bus, const char *unit_name, const char *templa
return log_oom();
if (need_daemon_reload(bus, unit_name) > 0) {
- log_warning("%s ignored: unit file changed on disk. Run 'systemctl%s daemon-reload'.",
- unit_name, arg_scope == UNIT_FILE_SYSTEM ? "" : " --user");
+ warn_unit_file_changed(unit_name);
return 0;
}