summaryrefslogtreecommitdiff
path: root/src/systemctl/systemctl.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-12-12 21:05:32 +0100
committerLennart Poettering <lennart@poettering.net>2014-12-15 19:02:17 +0100
commit0faacd470dfbd24f4c6504da6f04213aa05f9d19 (patch)
tree9b13b654d993efc475f9209f8b1cf602850ee27b /src/systemctl/systemctl.c
parent17d1f37d0dbd2d78b8866e1350c83a9755105144 (diff)
unit: handle nicely of certain unit types are not supported on specific systems
Containers do not really support .device, .automount or .swap units; Systems compiled without support for swap do not support .swap units; Systems without kdbus do not support .busname units. With this change attempts to start a unsupported unit types will result in an immediate "unsupported" job result, which is a lot more descriptive then before. Also, attempts to start device units in containers will now immediately fail instead of causing jobs to be enqueued that never go away.
Diffstat (limited to 'src/systemctl/systemctl.c')
-rw-r--r--src/systemctl/systemctl.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 8400bc8cd4..8a1b481fdc 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -2380,12 +2380,18 @@ static int check_wait_response(WaitData *d) {
assert(d->result);
if (!arg_quiet) {
- if (streq(d->result, "timeout"))
- log_error("Job for %s timed out.", strna(d->name));
- else if (streq(d->result, "canceled"))
+ if (streq(d->result, "canceled"))
log_error("Job for %s canceled.", strna(d->name));
+ else if (streq(d->result, "timeout"))
+ log_error("Job for %s timed out.", strna(d->name));
else if (streq(d->result, "dependency"))
log_error("A dependency job for %s failed. See 'journalctl -xe' for details.", strna(d->name));
+ else if (streq(d->result, "invalid"))
+ log_error("Job for %s invalid.", strna(d->name));
+ else if (streq(d->result, "assert"))
+ log_error("Assertion failed on job for %s.", strna(d->name));
+ else if (streq(d->result, "unsupported"))
+ log_error("Operation on or unit type of %s not supported on this system.", strna(d->name));
else if (!streq(d->result, "done") && !streq(d->result, "skipped")) {
if (d->name) {
bool quotes;
@@ -2400,12 +2406,18 @@ static int check_wait_response(WaitData *d) {
}
}
- if (streq(d->result, "timeout"))
- r = -ETIME;
- else if (streq(d->result, "canceled"))
+ if (streq(d->result, "canceled"))
r = -ECANCELED;
+ else if (streq(d->result, "timeout"))
+ r = -ETIME;
else if (streq(d->result, "dependency"))
r = -EIO;
+ else if (streq(d->result, "invalid"))
+ r = -ENOEXEC;
+ else if (streq(d->result, "assert"))
+ r = -EPROTO;
+ else if (streq(d->result, "unsupported"))
+ r = -ENOTSUP;
else if (!streq(d->result, "done") && !streq(d->result, "skipped"))
r = -EIO;