Current implementation uses XmlTemplates to process aliases in the recipe XML
during parsing phase. This works fine for tasks written in XML itself or
xincluded. For the Python tasks this currently does not work since the task
is not being processed for aliases. This patch prevents removal of available
top-level aliases from XmlTemplates processor so that python task can access
them via ControllerAPI during the task execution.
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
lnst/Controller/XmlTemplates.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lnst/Controller/XmlTemplates.py b/lnst/Controller/XmlTemplates.py
index 1a65c8b..7572b16 100644
--- a/lnst/Controller/XmlTemplates.py
+++ b/lnst/Controller/XmlTemplates.py
@@ -336,7 +336,10 @@ class XmlTemplates:
for child in element.getchildren():
self.process_aliases(child)
- self.drop_namespace_level()
+ # do not drop alias definitions when at top-level so that python
+ # tasks are able to access them
+ if element.tag != "lnstrecipe":
+ self.drop_namespace_level()
def expand_aliases(self, string):
while True:
--
1.8.1.4