]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
transaction: downgrade warnings about wanted unit which are not found 2322/head
authorFranck Bui <fbui@suse.com>
Thu, 14 Jan 2016 08:25:18 +0000 (09:25 +0100)
committerFranck Bui <fbui@suse.com>
Thu, 14 Jan 2016 09:46:12 +0000 (10:46 +0100)
If a unit was pulled by a Wants= dependency but its unit file was not
present then we logged this as an error.

However Wants= might be used to configure a soft/optional dependency
on another unit, ie. start an optional service only if it's installed
otherwise simply skip it. In this case emitting an error doesn't look
appropriate.

But it's still an error if the optional dependency exists but its
activation fails for any reasons.

src/core/transaction.c

index 2f163190e9d5535894d4bee1fe7a2bb03acb7281..bc85cef266bbb9ddc9091697adb0d7d9b685335a 100644 (file)
@@ -949,9 +949,10 @@ int transaction_add_job_and_dependencies(
                         SET_FOREACH(dep, ret->unit->dependencies[UNIT_WANTS], i) {
                                 r = transaction_add_job_and_dependencies(tr, JOB_START, dep, ret, false, false, false, ignore_order, e);
                                 if (r < 0) {
+                                        /* unit masked and unit not found are not considered as errors. */
                                         log_unit_full(dep,
-                                                      r == -EBADR /* unit masked */ ? LOG_DEBUG : LOG_WARNING, r,
-                                                      "Cannot add dependency job, ignoring: %s",
+                                                      r == -EBADR || r == -ENOENT ? LOG_DEBUG : LOG_WARNING,
+                                                      r, "Cannot add dependency job, ignoring: %s",
                                                       bus_error_message(e, r));
                                         sd_bus_error_free(e);
                                 }