commit 9c115c7faa6b909f981152bd4334dbfdd1ddc342
Author: Jan Tluka <jtluka(a)redhat.com>
Date: Tue Mar 18 18:38:06 2014 +0100
ControllerAPI: adding get_alias method to ControllerAPI
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>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Controller/Task.py | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
---
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. """