summaryrefslogtreecommitdiff
path: root/src/unit.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-02-24 03:24:23 +0100
committerLennart Poettering <lennart@poettering.net>2011-02-24 03:24:23 +0100
commitc0daa706d329d6cc593949b7d150d4972289ba93 (patch)
tree7ab14a6954c7c7de5f09e9c86910034f6d390ed1 /src/unit.c
parenta6a9a78d95e9ba302b259f6871433f510c606308 (diff)
job: also trigger on-failure dependencies when jobs faile due to dependencies, timeout
Diffstat (limited to 'src/unit.c')
-rw-r--r--src/unit.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/unit.c b/src/unit.c
index 1ca8e82af7..d75a06afc8 100644
--- a/src/unit.c
+++ b/src/unit.c
@@ -1071,6 +1071,16 @@ static void retroactively_stop_dependencies(Unit *u) {
unit_check_unneeded(other);
}
+void unit_trigger_on_failure(Unit *u) {
+ Unit *other;
+ Iterator i;
+
+ assert(u);
+
+ SET_FOREACH(other, u->meta.dependencies[UNIT_ON_FAILURE], i)
+ manager_add_job(u->meta.manager, JOB_START, other, JOB_REPLACE, true, NULL, NULL);
+}
+
void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_success) {
dual_timestamp ts;
bool unexpected;
@@ -1183,13 +1193,8 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_su
}
if (ns != os && ns == UNIT_FAILED) {
- Iterator i;
- Unit *other;
-
- SET_FOREACH(other, u->meta.dependencies[UNIT_ON_FAILURE], i)
- manager_add_job(u->meta.manager, JOB_START, other, JOB_REPLACE, true, NULL, NULL);
-
log_notice("Unit %s entered failed state.", u->meta.id);
+ unit_trigger_on_failure(u);
}
/* Some names are special */