def export_config(args, output_file=None):
if not output_file:
output_file = sys.stdout
if os.path.exists(args.config):
with open(args.config, 'rt') as f:
config = yaml.round_trip_load(f.read())
STATE['stages'] = config['stages']
config['config'] = _decrypt_dict(config['config'])
else:
config = {
'stages': {
env['name']: {
'environment': env['name'],
'key': 'enter-key-name-here'
} for env in STATE['awscreds'].environments
},
'config': {}}
if args.json:
output_file.write(json.dumps(config, indent=4))
elif config:
yaml.round_trip_dump(config, output_file)
评论列表
文章目录