You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.8 KiB
41 lines
1.8 KiB
From 0e6ec33b5e8c8790e60d1b79801dc360dad010d3 Mon Sep 17 00:00:00 2001 |
|
From: Michal Sekletar <msekleta@redhat.com> |
|
Date: Wed, 16 Mar 2016 15:47:18 +0100 |
|
Subject: [PATCH] core: look for instance when processing template name |
|
|
|
If first attempt to merge units failed and we are trying to do |
|
merge the other way around and at the same time we are working with |
|
template name, then other unit can't possibly be template, because it is |
|
not possible to have template unit running, only instances of the |
|
template. Thus we need to look for already active instance instead. |
|
|
|
rhel-only (upstream review pending) |
|
|
|
Related: #1159308 |
|
--- |
|
src/core/load-fragment.c | 11 ++++++++++- |
|
1 file changed, 10 insertions(+), 1 deletion(-) |
|
|
|
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c |
|
index 70c09188a..b188ec99d 100644 |
|
--- a/src/core/load-fragment.c |
|
+++ b/src/core/load-fragment.c |
|
@@ -3472,8 +3472,17 @@ static int merge_by_names(Unit **u, Set *names, const char *id) { |
|
/* Hmm, we couldn't merge the other unit into |
|
* ours? Then let's try it the other way |
|
* round */ |
|
+ if (unit_name_is_template(k) && (*u)->instance) { |
|
+ _cleanup_free_ char *instance = NULL; |
|
+ |
|
+ instance = unit_name_replace_instance(k, (*u)->instance); |
|
+ if(!instance) |
|
+ return -ENOMEM; |
|
+ other = manager_get_unit((*u)->manager, instance); |
|
+ |
|
+ } else |
|
+ other = manager_get_unit((*u)->manager, k); |
|
|
|
- other = manager_get_unit((*u)->manager, k); |
|
free(k); |
|
|
|
if (other) {
|
|
|