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

Commit

Permalink
Make config parser extensible
Browse files Browse the repository at this point in the history
This makes it possible to subclass the config parser, override it's
methods and then use this subclass when generating the CloudFormation
json. We need this so that bootstrap-salt can update the user data
section of the launch configuration.
  • Loading branch information
mattmb committed Jul 23, 2015
1 parent e8614fd commit 878f92d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
7 changes: 3 additions & 4 deletions CHANGELOG.md
@@ -1,7 +1,6 @@
##UNRELEASED

* Use a automatic resource naming to allow S3 bucket names to be auto named
by AWS
## Unreleased
* Make it possible to override the ConfigParser so that sub-modules can update the CloudFormation config.
* Use a automatic resource naming to allow S3 bucket names to be auto named by AWS

## Version 0.5.4

Expand Down
4 changes: 4 additions & 0 deletions README.rst
Expand Up @@ -304,6 +304,10 @@ If you wish to include some static cloudformation json and have it merged with t

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.

ConfigParser
++++++++++++++
If you want to include or modify cloudformation resources but need to include some logic and not a static include. You can subclass the ConfigParser and set the new class as `env.cloudformation_parser` in your fabfile.


Enabling RDS encryption
+++++++++++++++++++++++
Expand Down
2 changes: 1 addition & 1 deletion bootstrap_cfn/config.py
Expand Up @@ -43,7 +43,7 @@ def load_yaml(fp):
return yaml.load(open(fp).read())


class ConfigParser:
class ConfigParser(object):

config = {}

Expand Down
3 changes: 2 additions & 1 deletion bootstrap_cfn/fab_tasks.py
Expand Up @@ -271,7 +271,8 @@ def get_config():
env.environment,
passwords=env.stack_passwords)

cfn_config = ConfigParser(project_config.config, get_stack_name(), environment=env.environment, application=env.application)
Parser = env.get('cloudformation_parser', ConfigParser)
cfn_config = Parser(project_config.config, get_stack_name(), environment=env.environment, application=env.application)
return cfn_config


Expand Down

0 comments on commit 878f92d

Please sign in to comment.