summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2015-07-21 16:15:19 +0200
committerMichal Schmidt <mschmidt@redhat.com>2015-07-21 19:24:20 +0200
commit30961fa300cad21b50fe47baee523beeadb5d0bc (patch)
treecd403e4eaaabf21295071ce387a2fa3e8c6e5a14 /src/core
parentc382d69e3d39daedebcedb2da882beeb147a3cda (diff)
core: do not log done failed-condition jobs as if unit started
It is misleading to see "Started foo." in the log when the unit's condition was false.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/job.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/core/job.c b/src/core/job.c
index e2e9d876bb..e3ad1ddc73 100644
--- a/src/core/job.c
+++ b/src/core/job.c
@@ -683,13 +683,6 @@ static void job_print_status_message(Unit *u, JobType t, JobResult result) {
assert(t >= 0);
assert(t < _JOB_TYPE_MAX);
- /* Reload status messages have traditionally not been printed to console. */
- if (t == JOB_RELOAD)
- return;
-
- if (t == JOB_START && result == JOB_DONE && !u->condition_result)
- return;
-
format = job_get_status_message_format(u, t, result);
if (!format)
return;
@@ -759,6 +752,19 @@ static void job_log_status_message(Unit *u, JobType t, JobResult result) {
NULL);
}
+static void job_emit_status_message(Unit *u, JobType t, JobResult result) {
+
+ /* No message if the job did not actually do anything due to failed condition. */
+ if (t == JOB_START && result == JOB_DONE && !u->condition_result)
+ return;
+
+ job_log_status_message(u, t, result);
+
+ /* Reload status messages have traditionally not been printed to console. */
+ if (t != JOB_RELOAD)
+ job_print_status_message(u, t, result);
+}
+
static void job_fail_dependencies(Unit *u, UnitDependency d) {
Unit *other;
Iterator i;
@@ -794,8 +800,7 @@ int job_finish_and_invalidate(Job *j, JobResult result, bool recursive) {
log_unit_debug(u, "Job %s/%s finished, result=%s", u->id, job_type_to_string(t), job_result_to_string(result));
- job_print_status_message(u, t, result);
- job_log_status_message(u, t, result);
+ job_emit_status_message(u, t, result);
job_add_to_dbus_queue(j);