1 ###############################################################################
2 # Copyright (c) 2015 Ericsson AB and others.
3 # szilard.cserey@ericsson.com
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ###############################################################################
14 from dea import DeploymentEnvironmentAdapter
20 ASTUTE_YAML = '/etc/fuel/astute.yaml'
21 FUEL_BOOTSTRAP_CLI_YAML = '/opt/opnfv/fuel_bootstrap_cli.yaml'
27 python transplant_fuel_settings.py <deafile>
31 def parse_arguments():
32 if len(sys.argv) != 2:
35 dea_file = sys.argv[-1]
36 check_file_exists(dea_file)
40 def transplant(dea, astute):
41 fuel_conf = dea.get_fuel_config()
42 for key in fuel_conf.iterkeys():
43 if key == 'ADMIN_NETWORK':
44 for skey in fuel_conf[key].iterkeys():
45 astute[key][skey] = fuel_conf[key][skey]
47 astute[key] = fuel_conf[key]
51 def transplant_bootstrap(astute, fuel_bootstrap_cli):
52 if 'BOOTSTRAP' in astute:
53 for skey in astute['BOOTSTRAP'].iterkeys():
54 # FIXME: astute.yaml repos point to public ones instead of
55 # local mirrors, this filter should be removed when in sync
57 fuel_bootstrap_cli[skey] = astute['BOOTSTRAP'][skey]
58 return fuel_bootstrap_cli
61 dea_file = parse_arguments()
62 check_file_exists(ASTUTE_YAML)
63 check_file_exists(FUEL_BOOTSTRAP_CLI_YAML)
64 dea = DeploymentEnvironmentAdapter(dea_file)
65 with io.open(ASTUTE_YAML) as stream:
66 astute = yaml.load(stream)
67 transplant(dea, astute)
68 with io.open(ASTUTE_YAML, 'w') as stream:
69 yaml.dump(astute, stream, default_flow_style=False)
70 # Update bootstrap config yaml with info from DEA/astute.yaml
71 with io.open(FUEL_BOOTSTRAP_CLI_YAML) as stream:
72 fuel_bootstrap_cli = yaml.load(stream)
73 transplant_bootstrap(astute, fuel_bootstrap_cli)
74 with io.open(FUEL_BOOTSTRAP_CLI_YAML, 'w') as stream:
75 yaml.dump(fuel_bootstrap_cli, stream, default_flow_style=False)
78 if __name__ == '__main__':