def save_parameters(stack, params):
"""saves parameters to disk"""
# decode parameter dict
params_dict = {}
for param in params:
params_dict[param['ParameterKey']] = param['ParameterValue']
stack_dir = path.join('stacks', stack)
param_path = path.join(stack_dir, 'parameters.yaml')
# ensure paths are present
if not path.exists('stacks'):
mkdir('stacks')
if not path.exists(stack_dir):
mkdir(stack_dir)
with open(param_path, mode='w', encoding='utf-8') as file:
file.write(yaml.dump(params_dict, default_flow_style=False, explicit_start=True))
评论列表
文章目录