From: Steven Hardy Date: Tue, 4 Sep 2012 16:08:34 +0000 (+0100) Subject: heat tests : FuncUtils add get_stack_output function X-Git-Tag: 2014.1~1485 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=44bb725f41c6690dc13e3a350a5675469f24750a;p=openstack-build%2Fheat-build.git heat tests : FuncUtils add get_stack_output function Add a function to FuncUtils which allows us to easily parse the stack outputs defined in a template Change-Id: Ie1891cb11f54d019315350d449bdc5e22e340458 Signed-off-by: Steven Hardy --- diff --git a/heat/tests/functional/util.py b/heat/tests/functional/util.py index c8116fcc..0b1d946d 100644 --- a/heat/tests/functional/util.py +++ b/heat/tests/functional/util.py @@ -350,6 +350,22 @@ class FuncUtils: with open(filepaths[file]) as f: assert data == f.read() + def get_stack_output(self, output_key): + ''' + Extract a specified output from the DescribeStacks details + ''' + # Get the DescribeStacks result for this stack + parameters = {'StackName': self.stackname} + c = self.get_heat_client() + result = c.describe_stacks(**parameters) + + # Extract the OutputValue for the specified OutputKey + root = etree.fromstring(result) + output_list = root.xpath('//member[OutputKey="' + output_key + '"]') + output = output_list.pop() + value = output.findtext('OutputValue') + return value + def cleanup(self): self.ssh.close() subprocess.call(['heat', 'delete', self.stackname])