def process(self): template = self.base_template() vpc = self.vpc() map(template.add_resource, vpc) iam = self.iam() map(template.add_resource, iam) ec2 = self.ec2() map(template.add_resource, ec2) if "elb" in self.data: self.elb(template) if "rds" in self.data: self.rds(template) if "elasticache" in self.data: self.elasticache(template) if "s3" in self.data: self.s3(template) template = json.loads(template.to_json()) if "includes" in self.data: for inc_path in self.data["includes"]: inc = json.load(open(inc_path)) template = utils.dict_merge(template, inc) return json.dumps(template, sort_keys=True, indent=4, separators=(",", ": "))
def __init__(self, config, environment, passwords=None): try: self.config = self.load_yaml(config)[environment] except KeyError: raise errors.BootstrapCfnError("Environment " + environment + " not found") if passwords: passwords_dict = self.load_yaml(passwords)[environment] self.config = utils.dict_merge(self.config, passwords_dict)