Check for stack status before getting outputs.

Change-Id: Ie7ebcd582f5827c1476f2756779984e23ff17954
This commit is contained in:
Federico Ressi 2018-12-03 15:46:58 +01:00
parent 6af33964dd
commit 906a63d0e0
1 changed files with 3 additions and 0 deletions

View File

@ -78,6 +78,9 @@ class StackManager(object):
def get_output(self, stack, key):
"""Returns a specific value from stack outputs by using a given key."""
if stack.stack_status != constants.COMPLETE_STATUS:
raise ValueError("Invalid stack status: {!r}".format(
stack.stack_status))
for output in stack.outputs:
if output['output_key'] == key:
return output['output_value']