summaryrefslogtreecommitdiff
path: root/src/core/scope.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-04-07 15:43:59 +0200
committerLennart Poettering <lennart@poettering.net>2016-04-12 13:43:32 +0200
commit4f4afc88ecd8ab9cfe9e1eeea7e3aeb937811937 (patch)
treeb6463bfed0cbe018a0eae715b28f539fbff848b6 /src/core/scope.c
parent80b1ae32e1cab924086bb5224cde675df623df07 (diff)
downloadsystemd-4f4afc88ecd8ab9cfe9e1eeea7e3aeb937811937.tar.gz
core: rework how transient unit files and property drop-ins work
With this change the logic for placing transient unit files and drop-ins generated via "systemctl set-property" is reworked. The latter are now placed in the newly introduced "control" unit file directory. The fomer are now placed in the "transient" unit file directory. Note that the properties originally set when a transient unit was created will be written to and stay in the transient unit file directory, while later changes are done via drop-ins. This is preparation for a later "systemctl revert" addition, where existing drop-ins are flushed out, but the original transient definition is restored.
Diffstat (limited to 'src/core/scope.c')
-rw-r--r--src/core/scope.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/core/scope.c b/src/core/scope.c
index 92a3aed331..7078d1f7e9 100644
--- a/src/core/scope.c
+++ b/src/core/scope.c
@@ -155,25 +155,26 @@ static int scope_load(Unit *u) {
assert(u->load_state == UNIT_STUB);
if (!u->transient && !MANAGER_IS_RELOADING(u->manager))
+ /* Refuse to load non-transient scope units, but allow them while reloading. */
return -ENOENT;
- u->load_state = UNIT_LOADED;
-
- r = unit_load_dropin(u);
+ r = unit_load_fragment_and_dropin_optional(u);
if (r < 0)
return r;
- r = unit_patch_contexts(u);
- if (r < 0)
- return r;
+ if (u->load_state == UNIT_LOADED) {
+ r = unit_patch_contexts(u);
+ if (r < 0)
+ return r;
- r = unit_set_default_slice(u);
- if (r < 0)
- return r;
+ r = unit_set_default_slice(u);
+ if (r < 0)
+ return r;
- r = scope_add_default_dependencies(s);
- if (r < 0)
- return r;
+ r = scope_add_default_dependencies(s);
+ if (r < 0)
+ return r;
+ }
return scope_verify(s);
}