Improve error debugging

This commit is contained in:
Stefan Reimer 2019-08-03 21:31:17 +00:00
parent edbd13520d
commit 3f9e7827f8
2 changed files with 11 additions and 4 deletions

View File

@ -1,5 +1,9 @@
# Changelog
## 0.7.2
- Add line numbers to easy debugging
- Fix tests
## 0.7.1
- Release emergency bugfix, 0.7.0 broke recursive option parsing

View File

@ -49,9 +49,9 @@ class Stack(object):
self.onfailure = 'DELETE'
self.notfication_sns = []
self.tags.update(sg_config.get('tags'))
self.parameters.update(sg_config.get('parameters'))
self.options.update(sg_config.get('options'))
self.tags.update(sg_config.get('tags', {}))
self.parameters.update(sg_config.get('parameters', {}))
self.options.update(sg_config.get('options', {}))
if 'region' in sg_config:
self.region = sg_config['region']
@ -134,7 +134,10 @@ class Stack(object):
except Exception as e:
# In case we rendered invalid yaml this helps to debug
if self.cfn_template:
logger.error(self.cfn_template)
_output = ""
for i, line in enumerate(self.cfn_template.splitlines(), start=1):
_output = _output + '{}: {}\n'.format(i, line)
logger.error(_output)
raise e
if not re.search('CloudBender::', self.cfn_template):