daandemeyer / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
a4b143
From a38c3d5d4e94c7e11db1ca22126bb11c6b029886 Mon Sep 17 00:00:00 2001
a4b143
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
a4b143
Date: Sun, 15 Sep 2013 12:15:38 -0400
a4b143
Subject: [PATCH] transaction.c: do not point users to logs when unit not found
a4b143
a4b143
The logs are unlikely to contain any useful information in this case.
a4b143
a4b143
Also, change "walked on cycle path" to "found dependency on", which
a4b143
is less technical and indicates the direction. With the old message,
a4b143
I was never sure if prior units depended on later ones, or vice versa.
a4b143
a4b143
https://bugzilla.redhat.com/show_bug.cgi?id=996133
a4b143
https://bugzilla.redhat.com/show_bug.cgi?id=997082
a4b143
---
a4b143
 src/core/transaction.c | 14 +++++++++++---
a4b143
 1 file changed, 11 insertions(+), 3 deletions(-)
a4b143
a4b143
diff --git a/src/core/transaction.c b/src/core/transaction.c
a4b143
index 27efef7..203070f 100644
a4b143
--- a/src/core/transaction.c
a4b143
+++ b/src/core/transaction.c
a4b143
@@ -344,7 +344,7 @@ static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsi
a4b143
         assert(!j->transaction_prev);
a4b143
 
a4b143
         /* Does a recursive sweep through the ordering graph, looking
a4b143
-         * for a cycle. If we find cycle we try to break it. */
a4b143
+         * for a cycle. If we find a cycle we try to break it. */
a4b143
 
a4b143
         /* Have we seen this before? */
a4b143
         if (j->generation == generation) {
a4b143
@@ -371,7 +371,7 @@ static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsi
a4b143
 
a4b143
                         /* logging for j not k here here to provide consistent narrative */
a4b143
                         log_info_unit(j->unit->id,
a4b143
-                                      "Walked on cycle path to %s/%s",
a4b143
+                                      "Found dependency on %s/%s",
a4b143
                                       k->unit->id, job_type_to_string(k->type));
a4b143
 
a4b143
                         if (!delete &&
a4b143
@@ -860,7 +860,7 @@ int transaction_add_job_and_dependencies(
a4b143
                 return -EINVAL;
a4b143
         }
a4b143
 
a4b143
-        if (type != JOB_STOP && (unit->load_state == UNIT_ERROR || unit->load_state == UNIT_NOT_FOUND)) {
a4b143
+        if (type != JOB_STOP && unit->load_state == UNIT_ERROR) {
a4b143
                 dbus_set_error(e, BUS_ERROR_LOAD_FAILED,
a4b143
                                "Unit %s failed to load: %s. "
a4b143
                                "See system logs and 'systemctl status %s' for details.",
a4b143
@@ -870,6 +870,14 @@ int transaction_add_job_and_dependencies(
a4b143
                 return -EINVAL;
a4b143
         }
a4b143
 
a4b143
+        if (type != JOB_STOP && unit->load_state == UNIT_NOT_FOUND) {
a4b143
+                dbus_set_error(e, BUS_ERROR_LOAD_FAILED,
a4b143
+                               "Unit %s failed to load: %s.",
a4b143
+                               unit->id,
a4b143
+                               strerror(-unit->load_error));
a4b143
+                return -EINVAL;
a4b143
+        }
a4b143
+
a4b143
         if (type != JOB_STOP && unit->load_state == UNIT_MASKED) {
a4b143
                 dbus_set_error(e, BUS_ERROR_MASKED, "Unit %s is masked.", unit->id);
a4b143
                 return -EADDRNOTAVAIL;