1 From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
2 Date: Tue, 26 Jul 2016 18:07:55 +0200
3 Subject: [PATCH] deploy: Allow DEA to override bootstrap config
5 This commit does not change the current behavior in OPNFV, the
6 preconfigured fuel_bootstrap_cli.yaml from OPNFV ISO is still
7 used to replace the default settings / fuel-menu bootstrap cfg.
9 The only addition is the possibility to override the preconfigured
10 fuel_bootstrap_cli.yaml info using DEA.
14 Change-Id: I4e66b789fdf0a5b1af512a3efc84fedb72ce3b05
15 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
17 deploy/install_fuel_master.py | 6 +++---
18 deploy/transplant_fuel_settings.py | 17 +++++++++++++++++
19 2 files changed, 20 insertions(+), 3 deletions(-)
21 diff --git a/deploy/install_fuel_master.py b/deploy/install_fuel_master.py
22 index 5adccef..808d0b1 100644
23 --- a/deploy/install_fuel_master.py
24 +++ b/deploy/install_fuel_master.py
25 @@ -84,8 +84,8 @@ class InstallFuelMaster(object):
26 log('Wait until Fuel menu is up')
27 fuel_menu_pid = self.wait_until_fuel_menu_up()
29 - log('Inject our own astute.yaml settings')
30 - self.inject_own_astute_yaml()
31 + log('Inject our own astute.yaml and fuel_bootstrap_cli.yaml settings')
32 + self.inject_own_astute_and_bootstrap_yaml()
34 log('Let the Fuel deployment continue')
35 log('Found FUEL menu as PID %s, now killing it' % fuel_menu_pid)
36 @@ -181,7 +181,7 @@ class InstallFuelMaster(object):
37 ret = self.ssh.exec_cmd(cmd, check=check)
40 - def inject_own_astute_yaml(self):
41 + def inject_own_astute_and_bootstrap_yaml(self):
43 s.exec_cmd('rm -rf %s' % self.work_dir, False)
44 s.exec_cmd('mkdir %s' % self.work_dir)
45 diff --git a/deploy/transplant_fuel_settings.py b/deploy/transplant_fuel_settings.py
46 index e57a4fb..318c633 100644
47 --- a/deploy/transplant_fuel_settings.py
48 +++ b/deploy/transplant_fuel_settings.py
49 @@ -18,6 +18,7 @@ from common import (
52 ASTUTE_YAML = '/etc/fuel/astute.yaml'
53 +FUEL_BOOTSTRAP_CLI_YAML = '/opt/opnfv/fuel_bootstrap_cli.yaml'
57 @@ -47,18 +48,35 @@ def transplant(dea, astute):
61 +def transplant_bootstrap(astute, fuel_bootstrap_cli):
62 + if 'BOOTSTRAP' in astute:
63 + for skey in astute['BOOTSTRAP'].iterkeys():
64 + # FIXME: astute.yaml repos point to public ones instead of
65 + # local mirrors, this filter should be removed when in sync
67 + fuel_bootstrap_cli[skey] = astute['BOOTSTRAP'][skey]
68 + return fuel_bootstrap_cli
71 dea_file = parse_arguments()
72 check_file_exists(ASTUTE_YAML)
73 + check_file_exists(FUEL_BOOTSTRAP_CLI_YAML)
74 dea = DeploymentEnvironmentAdapter(dea_file)
75 log('Reading astute file %s' % ASTUTE_YAML)
76 with io.open(ASTUTE_YAML) as stream:
77 astute = yaml.load(stream)
78 log('Initiating transplant')
79 transplant(dea, astute)
80 with io.open(ASTUTE_YAML, 'w') as stream:
81 yaml.dump(astute, stream, default_flow_style=False)
82 - log('Transplant done')
83 + log('Transplant done for astute.yaml')
84 + # Update bootstrap config yaml with info from DEA/astute.yaml
85 + with io.open(FUEL_BOOTSTRAP_CLI_YAML) as stream:
86 + fuel_bootstrap_cli = yaml.load(stream)
87 + transplant_bootstrap(astute, fuel_bootstrap_cli)
88 + with io.open(FUEL_BOOTSTRAP_CLI_YAML, 'w') as stream:
89 + yaml.dump(fuel_bootstrap_cli, stream, default_flow_style=False)
90 + log('Transplant done for fuel_bootstrap_cli.yaml')
93 if __name__ == '__main__':