chiark / gitweb /
unit: don't show ENOENT configuration file warnings for units that are not essential
authorLennart Poettering <lennart@poettering.net>
Wed, 11 Aug 2010 23:05:35 +0000 (01:05 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 11 Aug 2010 23:05:35 +0000 (01:05 +0200)
fixme
src/manager.c
src/unit.c
src/unit.h

diff --git a/fixme b/fixme
index 6d0f5b2edb50a7c760f5ba0908b22afa3dc93846..47fb8a8c89e02b42dfc497841c80f55b5c017bbf 100644 (file)
--- a/fixme
+++ b/fixme
     chown root:utmp /var/run/utmp
     mkdir -p /var/lock/subsys
 
-* downgrade warnings for non-existent services pulled-in
-  by soft dependencies, like:
-    init[1]: Failed to load configuration for isdn.service: No such file or directory
-
 * have a simple syslog bridge providing /dev/log and forward messages
   to /dev/kmsg. at the moment the real syslog can be started, the bridge
   is stopped and the open /dev/log fd to the real syslog. that way we
@@ -71,8 +67,6 @@
 
 * if a service fails too often, make the service enter maintainence mode, and the socket, too.
 
-* don't show file not found msgs for irrelevant units
-
 * j->installed issue
 
 * plymouth boot.log
index 9684efac8b1cc3c2e4baa98b4aed133fa8f8ce2b..3e742f791e1251b3a3f3e257cb1328e113140696 100644 (file)
@@ -1392,9 +1392,15 @@ static int transaction_add_job_and_dependencies(
         assert(type < _JOB_TYPE_MAX);
         assert(unit);
 
-        if (type != JOB_STOP &&
-            unit->meta.load_state != UNIT_LOADED) {
-                dbus_set_error(e, BUS_ERROR_LOAD_FAILED, "Unit %s failed to load. See logs for details.", unit->meta.id);
+        if (unit->meta.load_state != UNIT_LOADED && unit->meta.load_state != UNIT_FAILED) {
+                dbus_set_error(e, BUS_ERROR_LOAD_FAILED, "Unit %s is not loaded properly.", unit->meta.id);
+                return -EINVAL;
+        }
+
+        if (type != JOB_STOP && unit->meta.load_state == UNIT_FAILED) {
+                dbus_set_error(e, BUS_ERROR_LOAD_FAILED, "Unit %s failed to load: %s. You might find more information in the logs.",
+                               unit->meta.id,
+                               strerror(-unit->meta.load_error));
                 return -EINVAL;
         }
 
index 59776c33e48e7a4def9382c68ff3175e72e162ee..e00425010af6e28f43dc5e70d2e82604273a53b7 100644 (file)
@@ -672,6 +672,9 @@ void unit_dump(Unit *u, FILE *f, const char *prefix) {
                 fprintf(f,
                         "%s\tMerged into: %s\n",
                         prefix, u->meta.merged_into->meta.id);
+        else if (u->meta.load_state == UNIT_FAILED)
+                fprintf(f, "%s\tLoad Error Code: %s\n", prefix, strerror(-u->meta.load_error));
+
 
         if (u->meta.job)
                 job_dump(u->meta.job, f, prefix2);
@@ -756,9 +759,10 @@ int unit_load(Unit *u) {
 
 fail:
         u->meta.load_state = UNIT_FAILED;
+        u->meta.load_error = r;
         unit_add_to_dbus_queue(u);
 
-        log_notice("Failed to load configuration for %s: %s", u->meta.id, strerror(-r));
+        log_debug("Failed to load configuration for %s: %s", u->meta.id, strerror(-r));
 
         return r;
 }
index a99d33ef07f4e5bea60eb532b47e9b56d33458f5..8bd81a26d4f14b21ccf24b5806db8564e082416a 100644 (file)
@@ -184,6 +184,9 @@ struct Meta {
          * unit here, if there was a job scheduled */
         int deserialized_job; /* This is actually of type JobType */
 
+        /* Error code when we didn't manage to load the unit (negative) */
+        int load_error;
+
         /* If we go down, pull down everything that depends on us, too */
         bool recursive_stop;