From 3b6fdb5b5afebc49a7e987e3e3bf7aa2615d1671 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 12 Jul 2010 02:56:17 +0200 Subject: unit: introduce IgnoreDependencyFailure= --- src/job.c | 9 ++++++--- src/load-fragment.c | 1 + src/unit.c | 6 ++++-- src/unit.h | 3 +++ 4 files changed, 14 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/job.c b/src/job.c index 7cbde80b38..8cc9d742ed 100644 --- a/src/job.c +++ b/src/job.c @@ -495,14 +495,16 @@ int job_finish_and_invalidate(Job *j, bool success) { t == JOB_RELOAD_OR_START) { SET_FOREACH(other, u->meta.dependencies[UNIT_REQUIRED_BY], i) - if (other->meta.job && + if (!other->meta.ignore_dependency_failure && + other->meta.job && (other->meta.job->type == JOB_START || other->meta.job->type == JOB_VERIFY_ACTIVE || other->meta.job->type == JOB_RELOAD_OR_START)) job_finish_and_invalidate(other->meta.job, false); SET_FOREACH(other, u->meta.dependencies[UNIT_REQUIRED_BY_OVERRIDABLE], i) - if (other->meta.job && + if (!other->meta.ignore_dependency_failure && + other->meta.job && !other->meta.job->override && (other->meta.job->type == JOB_START || other->meta.job->type == JOB_VERIFY_ACTIVE || @@ -512,7 +514,8 @@ int job_finish_and_invalidate(Job *j, bool success) { } else if (t == JOB_STOP) { SET_FOREACH(other, u->meta.dependencies[UNIT_CONFLICTS], i) - if (other->meta.job && + if (!other->meta.ignore_dependency_failure && + other->meta.job && (other->meta.job->type == JOB_START || other->meta.job->type == JOB_VERIFY_ACTIVE || other->meta.job->type == JOB_RELOAD_OR_START)) diff --git a/src/load-fragment.c b/src/load-fragment.c index 1d40b69c98..8e4ec74b07 100644 --- a/src/load-fragment.c +++ b/src/load-fragment.c @@ -1562,6 +1562,7 @@ static int load_from_path(Unit *u, const char *path) { { "StopWhenUnneeded", config_parse_bool, &u->meta.stop_when_unneeded, "Unit" }, { "OnlyByDependency", config_parse_bool, &u->meta.only_by_dependency, "Unit" }, { "DefaultDependencies", config_parse_bool, &u->meta.default_dependencies, "Unit" }, + { "IgnoreDependencyFailure",config_parse_bool, &u->meta.ignore_dependency_failure, "Unit" }, { "PIDFile", config_parse_path, &u->service.pid_file, "Service" }, { "ExecStartPre", config_parse_exec, u->service.exec_command+SERVICE_EXEC_START_PRE, "Service" }, diff --git a/src/unit.c b/src/unit.c index b362fd3b41..66372f2a92 100644 --- a/src/unit.c +++ b/src/unit.c @@ -626,11 +626,13 @@ void unit_dump(Unit *u, FILE *f, const char *prefix) { "%s\tRecursive Stop: %s\n" "%s\tStopWhenUnneeded: %s\n" "%s\tOnlyByDependency: %s\n" - "%s\tDefaultDependencies: %s\n", + "%s\tDefaultDependencies: %s\n" + "%s\tIgnoreDependencyFailure: %s\n", prefix, yes_no(u->meta.recursive_stop), prefix, yes_no(u->meta.stop_when_unneeded), prefix, yes_no(u->meta.only_by_dependency), - prefix, yes_no(u->meta.default_dependencies)); + prefix, yes_no(u->meta.default_dependencies), + prefix, yes_no(u->meta.ignore_dependency_failure)); LIST_FOREACH(by_unit, b, u->meta.cgroup_bondings) fprintf(f, "%s\tControlGroup: %s:%s\n", diff --git a/src/unit.h b/src/unit.h index c9fd4a538c..3f4bbd9ed7 100644 --- a/src/unit.h +++ b/src/unit.h @@ -184,6 +184,9 @@ struct Meta { /* Create default depedencies */ bool default_dependencies; + /* Bring up this unit even if a dependency fails to start */ + bool ignore_dependency_failure; + /* When deserializing, temporarily store the job type for this * unit here, if there was a job scheduled */ int deserialized_job; /* This is actually of type JobType */ -- cgit v1.2.3-54-g00ecf