ControllerAPI now provides get_alias() method to get alias defined in the
recipe XML.
Example:
my_value = ctl.get_alias("my_alias")
The code above gets the value of the alias named "my_alias" previously defined
in <lnstrecipe> namespace, e.g:
<lnstrecipe>
<define>
<alias name="my_alias" value="my_value"/>
</define>
...
</lnstrecipe>
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
lnst/Controller/Task.py | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/lnst/Controller/Task.py b/lnst/Controller/Task.py
index b028231..10c9f02 100644
--- a/lnst/Controller/Task.py
+++ b/lnst/Controller/Task.py
@@ -78,6 +78,18 @@ class ControllerAPI(object):
cmd = {"type": "ctl_wait", "seconds":
int(seconds)}
return self._ctl._run_command(cmd)
+ def get_alias(self, alias):
+ """
+ Get the value of user defined alias.
+
+ :param alias: name of user defined alias
+ :type alias: string
+
+ :return: value of a user defined alias
+ :rtype: string
+ """
+ return self._ctl._get_alias(alias)
+
class HostAPI(object):
""" An API class representing a host machine. """
--
1.8.1.4