summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Mack <github@zonque.org>2016-03-17 20:24:39 +0100
committerDaniel Mack <github@zonque.org>2016-03-17 20:24:39 +0100
commit90e644608ebf94f5f3c8acb1317bf4723826e337 (patch)
tree2de26c4cb4dc7b399e92510df482b87c213c6c01 /src
parent2ddbdcc9c24b802564784f0812611b368a733e51 (diff)
parent7aad67e7f2b3dfbc3b5a884471bd551e4bf997cc (diff)
Merge pull request #2856 from msekletar/merge-instance
core: look for instance when processing template name
Diffstat (limited to 'src')
-rw-r--r--src/core/load-fragment.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index e1bfdccbca..d078924c5b 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -3507,7 +3507,19 @@ static int merge_by_names(Unit **u, Set *names, const char *id) {
* ours? Then let's try it the other way
* round */
- other = manager_get_unit((*u)->manager, k);
+ /* If the symlink name we are looking at is unit template, then
+ we must search for instance of this template */
+ if (unit_name_is_valid(k, UNIT_NAME_TEMPLATE)) {
+ _cleanup_free_ char *instance = NULL;
+
+ r = unit_name_replace_instance(k, (*u)->instance, &instance);
+ if (r < 0)
+ return r;
+
+ other = manager_get_unit((*u)->manager, instance);
+ } else
+ other = manager_get_unit((*u)->manager, k);
+
free(k);
if (other) {