systemctl: include -M or -H arguments in the hint

https://github.com/systemd/systemd/issues/2431

Some newlines are added, but the output will still exceed 80 columns in many
cases. The fallback for oom conditions is changed from "n/a" to something
"<service>", and a similar pattern is used for the new code. This way we
have a realistic fallback for oom, which seems nicer than making the whole
function return an error code which would then have to be propagated.

$ systemctl -M fedora-rawhide restart systemd-networkd.service
Job for systemd-networkd.service failed because start of the service was attempted too often.
See "systemctl -M fedora-rawhide status systemd-networkd.service" and "journalctl -M fedora-rawhide -xe" for details.
To force a start use "systemctl -M fedora-rawhide reset-failed systemd-networkd.service"
followed by "systemctl -M fedora-rawhide start systemd-networkd.service" again.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2016-02-15 15:23:45 -05:00
parent 8eff97a103
commit 4524439edb
3 changed files with 43 additions and 23 deletions
+16 -2
View File
@@ -2778,9 +2778,23 @@ static int start_unit(int argc, char *argv[], void *userdata) {
}
if (!arg_no_block) {
int q;
int q, arg_count = 1;
const char* extra_args[5] = {NULL};
q = bus_wait_for_jobs(w, arg_quiet, arg_scope != UNIT_FILE_SYSTEM ? "--user" : NULL);
/* leave first empty for the actual command name*/
if (arg_scope != UNIT_FILE_SYSTEM)
extra_args[arg_count++] = "--user";
assert(IN_SET(arg_transport, BUS_TRANSPORT_LOCAL, BUS_TRANSPORT_REMOTE, BUS_TRANSPORT_MACHINE));
if (arg_transport == BUS_TRANSPORT_REMOTE) {
extra_args[arg_count++] = "-H";
extra_args[arg_count++] = arg_host;
} else if (arg_transport == BUS_TRANSPORT_MACHINE) {
extra_args[arg_count++] = "-M";
extra_args[arg_count++] = arg_host;
}
q = bus_wait_for_jobs(w, arg_quiet, extra_args);
if (q < 0)
return q;