]> err.no Git - systemd/commitdiff
job: introduce new job result code 'skipped' to use when pre conditions of job did...
authorLennart Poettering <lennart@poettering.net>
Tue, 8 Mar 2011 00:44:19 +0000 (01:44 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 8 Mar 2011 00:53:47 +0000 (01:53 +0100)
https://bugzilla.redhat.com/show_bug.cgi?id=682245
https://bugzilla.redhat.com/show_bug.cgi?id=635780

src/job.c
src/job.h
src/systemctl.c

index 206490ffbb30d2daee7e782126d65d9398ab1aca..f5d3ff8a3a834f441d4633a40433944af2404e44 100644 (file)
--- a/src/job.c
+++ b/src/job.c
@@ -465,6 +465,8 @@ int job_run_and_invalidate(Job *j) {
         if ((j = manager_get_job(m, id))) {
                 if (r == -EALREADY)
                         r = job_finish_and_invalidate(j, JOB_DONE);
+                else if (r == -ENOEXEC)
+                        r = job_finish_and_invalidate(j, JOB_SKIPPED);
                 else if (r == -EAGAIN)
                         j->state = JOB_WAITING;
                 else if (r < 0)
@@ -702,7 +704,8 @@ static const char* const job_result_table[_JOB_RESULT_MAX] = {
         [JOB_CANCELED] = "canceled",
         [JOB_TIMEOUT] = "timeout",
         [JOB_FAILED] = "failed",
-        [JOB_DEPENDENCY] = "dependency"
+        [JOB_DEPENDENCY] = "dependency",
+        [JOB_SKIPPED] = "skipped"
 };
 
 DEFINE_STRING_TABLE_LOOKUP(job_result, JobResult);
index de0c1d2317aa318009444e0d7c08a27931a9f6db..2c65d94879b2270aade1c4bb2ffb4e3808154d69 100644 (file)
--- a/src/job.h
+++ b/src/job.h
@@ -78,6 +78,7 @@ enum JobResult {
         JOB_TIMEOUT,
         JOB_FAILED,
         JOB_DEPENDENCY,
+        JOB_SKIPPED,
         _JOB_RESULT_MAX,
         _JOB_RESULT_INVALID = -1
 };
index 6adcbcc066a6ee9ff3f3b01c90e6727506f067d4..f5a87fc701c254bf2f9e613a76f386a3195f3bcc 100644 (file)
@@ -1249,7 +1249,7 @@ static int wait_for_jobs(DBusConnection *bus, Set *s) {
                         log_error("Job canceled.");
                 else if (streq(d.result, "dependency"))
                         log_error("A dependency job failed. See system logs for details.");
-                else if (!streq(d.result, "done"))
+                else if (!streq(d.result, "done") && !streq(d.result, "skipped"))
                         log_error("Job failed. See system logs and 'systemctl status' for details.");
         }
 
@@ -1257,7 +1257,7 @@ static int wait_for_jobs(DBusConnection *bus, Set *s) {
                 r = -ETIME;
         else if (streq_ptr(d.result, "canceled"))
                 r = -ECANCELED;
-        else if (!streq_ptr(d.result, "done"))
+        else if (!streq_ptr(d.result, "done") && !streq_ptr(d.result, "skipped"))
                 r = -EIO;
         else
                 r = 0;
@@ -1417,11 +1417,15 @@ static int start_unit(DBusConnection *bus, char **args, unsigned n) {
                         streq(args[0], "stop")                  ? "StopUnit" :
                         streq(args[0], "reload")                ? "ReloadUnit" :
                         streq(args[0], "restart")               ? "RestartUnit" :
+
                         streq(args[0], "try-restart")           ||
                         streq(args[0], "condrestart")           ? "TryRestartUnit" :
+
                         streq(args[0], "reload-or-restart")     ? "ReloadOrRestartUnit" :
+
                         streq(args[0], "reload-or-try-restart") ||
                         streq(args[0], "condreload") ||
+
                         streq(args[0], "force-reload")          ? "ReloadOrTryRestartUnit" :
                                                                   "StartUnit";