summaryrefslogtreecommitdiff
path: root/src/core/job.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-11-06 13:43:45 +0100
committerLennart Poettering <lennart@poettering.net>2014-11-06 14:21:11 +0100
commit59fccdc587bc179c1638916ee16a24099f94f81f (patch)
tree65e65016e68023b5ff9d5d4327e1abc06ffd3756 /src/core/job.c
parentcc50ef134b4104cae8783a4ca40b1a70247e3ef9 (diff)
core: introduce the concept of AssertXYZ= similar to ConditionXYZ=, but fatal for a start job if not met
Diffstat (limited to 'src/core/job.c')
-rw-r--r--src/core/job.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/core/job.c b/src/core/job.c
index eaa4bb17fc..51d15811b5 100644
--- a/src/core/job.c
+++ b/src/core/job.c
@@ -542,6 +542,8 @@ int job_run_and_invalidate(Job *j) {
r = job_finish_and_invalidate(j, JOB_SKIPPED, true);
else if (r == -ENOEXEC)
r = job_finish_and_invalidate(j, JOB_INVALID, true);
+ else if (r == -EPROTO)
+ r = job_finish_and_invalidate(j, JOB_ASSERT, true);
else if (r == -EAGAIN) {
j->state = JOB_WAITING;
m->n_running_jobs--;
@@ -655,6 +657,11 @@ static void job_print_status_message(Unit *u, JobType t, JobResult result) {
unit_status_printf(u, ANSI_HIGHLIGHT_RED_ON " TIME " ANSI_HIGHLIGHT_OFF, format);
break;
+ case JOB_ASSERT:
+ manager_flip_auto_status(u->manager, true);
+ unit_status_printf(u, ANSI_HIGHLIGHT_YELLOW_ON "ASSERT" ANSI_HIGHLIGHT_OFF, format);
+ break;
+
default:
;
}
@@ -1189,6 +1196,7 @@ static const char* const job_result_table[_JOB_RESULT_MAX] = {
[JOB_DEPENDENCY] = "dependency",
[JOB_SKIPPED] = "skipped",
[JOB_INVALID] = "invalid",
+ [JOB_ASSERT] = "assert",
};
DEFINE_STRING_TABLE_LOOKUP(job_result, JobResult);