in pipeline/iam_generator_deploy.py [0:0]
def deploy_stack(cfn_c, stack_name, template, capabilities=[]):
kw_args = {
"StackName": stack_name,
}
if template.startswith("http"):
kw_args["TemplateURL"] = template
else:
kw_args["TemplateBody"] = template
if len(capabilities) > 0:
kw_args["Capabilities"] = capabilities
stack_exists = True
try:
cfn_c.describe_stacks(
StackName=stack_name
)
except Exception:
stack_exists = False
if stack_exists:
cfn_c.update_stack(
**kw_args
)
return(
cfn_c.get_waiter(
"stack_update_complete"
)
)
else:
cfn_c.create_stack(
**kw_args
)
return(
cfn_c.get_waiter(
"stack_create_complete"
)
)