Skip to content

Commit

Permalink
Fix issue#64 - Taskcat exits in get_teststate() when describestack fails
Browse files Browse the repository at this point in the history
  • Loading branch information
sshvans committed Feb 28, 2018
1 parent 30332dd commit c15582c
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions taskcat/stacker.py
Original file line number Diff line number Diff line change
Expand Up @@ -1652,21 +1652,27 @@ def getofile(region, stack_name, resource_type):
return str(location)

def get_teststate(stackname, region):
# Add try catch and return MANUALLY_DELETED
# Add css test-orange
cfn = self._boto_client.get('cloudformation', region)
test_query = cfn.describe_stacks(StackName=stackname)
rstatus = None
status_css = None
try:
cfn = self._boto_client.get('cloudformation', region)
test_query = cfn.describe_stacks(StackName=stackname)

for result in test_query['Stacks']:
rstatus = result.get('StackStatus')
if rstatus == 'CREATE_COMPLETE':
status_css = 'class=test-green'
elif rstatus == 'CREATE_FAILED':
status_css = 'class=test-red'
else:
status_css = 'class=test-red'
except Exception as e:
print(E + "Error describing stack named [%s] " % stackname)
if self.verbose:
print(D + str(e))
rstatus = 'MANUALLY_DELETED'
status_css = 'class=test-orange'

for result in test_query['Stacks']:
rstatus = result.get('StackStatus')
if rstatus == 'CREATE_COMPLETE':
status_css = 'class=test-green'
elif rstatus == 'CREATE_FAILED':
status_css = 'class=test-red'
else:
status_css = 'class=test-red'
return rstatus, status_css

tag = doc.tag
Expand Down

0 comments on commit c15582c

Please sign in to comment.