diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2019-10-24 14:09:11 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-10-25 13:41:49 +0900 |
commit | df7c4eb62a22a5b131007d98ee49f57f6f95483e (patch) | |
tree | fd7edf3e3402c294ebb45a3c60ff0ba91558bca0 /src/run | |
parent | 1c089741d3b56ab096c5c401089f68b293b5fa38 (diff) | |
download | systemd-df7c4eb62a22a5b131007d98ee49f57f6f95483e.tar.gz |
various tools: be more explicit when a glob is passed when not supported
See https://bugzilla.redhat.com/show_bug.cgi?id=1763488: when we say that
'foo@*.service' is not a valid unit name, this is not clear enough. Let's
include the name of the operation that does not support globbing in the
error message:
$ build/systemctl enable 'foo@*.service'
Glob pattern passed to enable, but globs are not supported for this.
Invalid unit name "foo@*.service" escaped as "foo@\x2a.service".
...
Diffstat (limited to 'src/run')
-rw-r--r-- | src/run/run.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/run/run.c b/src/run/run.c index e7d8b30a7a..afa9d14af3 100644 --- a/src/run/run.c +++ b/src/run/run.c @@ -641,7 +641,9 @@ static int transient_cgroup_set_properties(sd_bus_message *m) { if (!isempty(arg_slice)) { _cleanup_free_ char *slice = NULL; - r = unit_name_mangle_with_suffix(arg_slice, arg_quiet ? 0 : UNIT_NAME_MANGLE_WARN, ".slice", &slice); + r = unit_name_mangle_with_suffix(arg_slice, "as slice", + arg_quiet ? 0 : UNIT_NAME_MANGLE_WARN, + ".slice", &slice); if (r < 0) return log_error_errno(r, "Failed to mangle name '%s': %m", arg_slice); @@ -1112,7 +1114,9 @@ static int start_transient_service( } if (arg_unit) { - r = unit_name_mangle_with_suffix(arg_unit, arg_quiet ? 0 : UNIT_NAME_MANGLE_WARN, ".service", &service); + r = unit_name_mangle_with_suffix(arg_unit, "as unit", + arg_quiet ? 0 : UNIT_NAME_MANGLE_WARN, + ".service", &service); if (r < 0) return log_error_errno(r, "Failed to mangle unit name: %m"); } else { @@ -1355,7 +1359,9 @@ static int start_transient_scope(sd_bus *bus) { return log_oom(); if (arg_unit) { - r = unit_name_mangle_with_suffix(arg_unit, arg_quiet ? 0 : UNIT_NAME_MANGLE_WARN, ".scope", &scope); + r = unit_name_mangle_with_suffix(arg_unit, "as unit", + arg_quiet ? 0 : UNIT_NAME_MANGLE_WARN, + ".scope", &scope); if (r < 0) return log_error_errno(r, "Failed to mangle scope name: %m"); } else { @@ -1530,11 +1536,15 @@ static int start_transient_trigger( break; default: - r = unit_name_mangle_with_suffix(arg_unit, arg_quiet ? 0 : UNIT_NAME_MANGLE_WARN, ".service", &service); + r = unit_name_mangle_with_suffix(arg_unit, "as unit", + arg_quiet ? 0 : UNIT_NAME_MANGLE_WARN, + ".service", &service); if (r < 0) return log_error_errno(r, "Failed to mangle unit name: %m"); - r = unit_name_mangle_with_suffix(arg_unit, arg_quiet ? 0 : UNIT_NAME_MANGLE_WARN, suffix, &trigger); + r = unit_name_mangle_with_suffix(arg_unit, "as trigger", + arg_quiet ? 0 : UNIT_NAME_MANGLE_WARN, + suffix, &trigger); if (r < 0) return log_error_errno(r, "Failed to mangle unit name: %m"); |