Bugfix for broken option handling in 0.7.0

This commit is contained in:
Stefan Reimer 2019-07-28 13:02:18 +00:00
parent 3fcca2b782
commit edbd13520d
4 changed files with 27 additions and 11 deletions

View File

@ -1,5 +1,8 @@
# Changelog # Changelog
## 0.7.1
- Release emergency bugfix, 0.7.0 broke recursive option parsing
## 0.7.0 ## 0.7.0
- Add support for SNS Notifcations to Cloudformation create and update operations - Add support for SNS Notifcations to Cloudformation create and update operations
- Refactored recursive handling of options withing stack groups - Refactored recursive handling of options withing stack groups

View File

@ -2,7 +2,7 @@ import logging
__author__ = "Stefan Reimer" __author__ = "Stefan Reimer"
__email__ = "stefan@zero-downtimet.net" __email__ = "stefan@zero-downtimet.net"
__version__ = "0.7.0" __version__ = "0.7.1"
# Set up logging to ``/dev/null`` like a library is supposed to. # Set up logging to ``/dev/null`` like a library is supposed to.

View File

@ -4,6 +4,7 @@ import hashlib
import oyaml as yaml import oyaml as yaml
import json import json
import time import time
import pprint
from datetime import datetime, timedelta from datetime import datetime, timedelta
from dateutil.tz import tzutc from dateutil.tz import tzutc
@ -33,20 +34,31 @@ class StackStatus(object):
class Stack(object): class Stack(object):
def __init__(self, name, template, path, rel_path, sg_config={}, ctx={}): def __init__(self, name, template, path, rel_path, sg_config, ctx):
self.stackname = name self.stackname = name
self.template = template self.template = template
self.path = path self.path = path
self.rel_path = rel_path self.rel_path = rel_path
self.ctx = ctx self.ctx = ctx
self.tags = sg_config.get('tags', {}) self.tags = {}
self.parameters = sg_config.get('parameters', {}) self.parameters = {}
self.options = sg_config.get('options', {}) self.options = {}
self.region = sg_config.get('region', 'global') self.region = 'global'
self.profile = sg_config.get('profile', '') self.profile = ''
self.onfailure = sg_config.get('onfailure', "DELETE") self.onfailure = 'DELETE'
self.notfication_sns = sg_config.get('notification_sns', []) self.notfication_sns = []
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']
if 'profile' in sg_config:
self.profile = sg_config['profile']
if 'notfication_sns' in sg_config:
self.notfication_sns = sg_config['notfication_sns']
self.id = (self.profile, self.region, self.stackname) self.id = (self.profile, self.region, self.stackname)
@ -63,7 +75,7 @@ class Stack(object):
self.multi_delete = True self.multi_delete = True
def dump_config(self): def dump_config(self):
logger.debug("<Stack {}: {}>".format(self.id, vars(self))) logger.debug("<Stack {}: {}>".format(self.id, pprint.pformat(vars(self))))
def read_config(self): def read_config(self):
_config = read_config_file(self.path) _config = read_config_file(self.path)

View File

@ -1,6 +1,7 @@
import os import os
import glob import glob
import logging import logging
import pprint
from .utils import dict_merge from .utils import dict_merge
from .jinja import read_config_file from .jinja import read_config_file
@ -26,7 +27,7 @@ class StackGroup(object):
for sg in self.sgs: for sg in self.sgs:
sg.dump_config() sg.dump_config()
logger.debug("<StackGroup {}: {}>".format(self.name, self.config)) logger.debug("StackGroup {}: {}".format(self.rel_path, pprint.pformat(self.config)))
for s in self.stacks: for s in self.stacks:
s.dump_config() s.dump_config()