Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Commit

Permalink
Fix include merging.
Browse files Browse the repository at this point in the history
This commit fixes a couple of mistakes in the merging code for included
cloudformation templates. It also makes the documentation clearer on how
the merge works.
  • Loading branch information
mattmb committed Apr 14, 2015
1 parent 7cc58f6 commit 21d6a8e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,4 @@ If you wish to include some static cloudformation json and have it merged with t
includes:
- /path/to/cloudformation.json

The tool will then merge this with the generated template *overwriting* any keys in the original template that clash.
The tool will then perform a deep merge of the includes with the generated template dictionary. Any keys or subkeys in the template dictionary that clash will have their values **overwritten** by the included dictionary or recursively merged if the value is itself a dictionary.
2 changes: 1 addition & 1 deletion bootstrap_cfn/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def process(self):
if 'includes' in self.data:
for inc_path in self.data['includes']:
inc = json.load(open(inc_path))
utils.dict_merge(template, inc)
template = utils.dict_merge(template, inc)
return json.dumps(
template, sort_keys=True, indent=4, separators=(',', ': '))

Expand Down
2 changes: 1 addition & 1 deletion bootstrap_cfn/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def dict_merge(target, *args):
# Merge multiple dicts
if len(args) > 1:
for obj in args:
self.dict_merge(target, obj)
dict_merge(target, obj)
return target

# Recursively merge dicts and set non-dict values
Expand Down

0 comments on commit 21d6a8e

Please sign in to comment.