summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2014-10-30 20:12:05 -0400
committerPedro Alvarez <pedro.alvarez@codethink.co.uk>2015-01-29 12:25:07 +0000
commit91ccc5de3fc0fdd26e128f690b6c8cbe49d6f230 (patch)
tree8b6384a2aaaae53848885202ffc6769a984a439b
parent941a643569dc6b53d0b334276d2a3cc0ed159e88 (diff)
downloadsystemd-baserock/pedroalvarez/v217.tar.gz
shared/install: avoid prematurely rejecting "missing" unitsbaserock/pedroalvarez/v217
f7101b7368df copied some logic to prevent enabling masked units, but also added a check which causes attempts to enable templated units to fail. Since we know the logic beyond this check will properly handle units which truly do not exist, we can rely on the unit file state comparison to suffice for expressing the intent of f7101b7368df. ref: https://bugs.archlinux.org/task/42616
-rw-r--r--src/shared/install.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/shared/install.c b/src/shared/install.c
index 035b44cc52..cab93e8dc6 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -1620,12 +1620,10 @@ int unit_file_enable(
STRV_FOREACH(i, files) {
UnitFileState state;
+ /* We only want to know if this unit is masked, so we ignore
+ * errors from unit_file_get_state, deferring other checks.
+ * This allows templated units to be enabled on the fly. */
state = unit_file_get_state(scope, root_dir, *i);
- if (state < 0) {
- log_error("Failed to get unit file state for %s: %s", *i, strerror(-state));
- return state;
- }
-
if (state == UNIT_FILE_MASKED || state == UNIT_FILE_MASKED_RUNTIME) {
log_error("Failed to enable unit: Unit %s is masked", *i);
return -ENOTSUP;