aboutsummaryrefslogtreecommitdiffstats
path: root/patches/opnfv-fuel/0039-deploy-Allow-DEA-to-override-bootstrap-config.patch
blob: 2d1013a8f931f94031ee94e80b9b316aff41bb77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /*
From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
Date: Tue, 26 Jul 2016 18:07:55 +0200
Subject: [PATCH] deploy: Allow DEA to override bootstrap config

This commit does not change the current behavior in OPNFV, the
preconfigured fuel_bootstrap_cli.yaml from OPNFV ISO is still
used to replace the default settings / fuel-menu bootstrap cfg.

The only addition is the possibility to override the preconfigured
fuel_bootstrap_cli.yaml info using DEA.

JIRA: FUEL-155

Change-Id: I4e66b789fdf0a5b1af512a3efc84fedb72ce3b05
Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
---
 deploy/install_fuel_master.py      |  7 ++++---
 deploy/transplant_fuel_settings.py | 20 +++++++++++++++++++-
 2 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/deploy/install_fuel_master.py b/deploy/install_fuel_master.py
index 5adccef..adadcb5 100644
--- a/deploy/install_fuel_master.py
+++ b/deploy/install_fuel_master.py
@@ -84,14 +84,15 @@ class InstallFuelMaster(object):
         log('Wait until Fuel menu is up')
         fuel_menu_pid = self.wait_until_fuel_menu_up()
 
-        log('Inject our own astute.yaml settings')
-        self.inject_own_astute_yaml()
+        log('Inject our own astute.yaml and fuel_bootstrap_cli.yaml settings')
+        self.inject_own_astute_and_bootstrap_yaml()
 
         log('Let the Fuel deployment continue')
         log('Found FUEL menu as PID %s, now killing it' % fuel_menu_pid)
         self.ssh_exec_cmd('kill %s' % fuel_menu_pid, False)
 
         log('Wait until installation is complete')
+        time.sleep(60)
         self.wait_until_installation_completed()
 
         log('Waiting for one minute for Fuel to stabilize')
@@ -181,7 +182,7 @@ class InstallFuelMaster(object):
             ret = self.ssh.exec_cmd(cmd, check=check)
         return ret
 
-    def inject_own_astute_yaml(self):
+    def inject_own_astute_and_bootstrap_yaml(self):
         with self.ssh as s:
             s.exec_cmd('rm -rf %s' % self.work_dir, False)
             s.exec_cmd('mkdir %s' % self.work_dir)
diff --git a/deploy/transplant_fuel_settings.py b/deploy/transplant_fuel_settings.py
index 9a65cf6..8684d57 100644
--- a/deploy/transplant_fuel_settings.py
+++ b/deploy/transplant_fuel_settings.py
@@ -22,6 +22,7 @@ from common import (
 )
 
 ASTUTE_YAML = '/etc/fuel/astute.yaml'
+FUEL_BOOTSTRAP_CLI_YAML = '/opt/opnfv/fuel_bootstrap_cli.yaml'
 
 
 def usage():
@@ -81,9 +82,19 @@ def transplant(dea, astute):
     return astute
 
 
+def transplant_bootstrap(astute, fuel_bootstrap_cli):
+    if 'BOOTSTRAP' in astute:
+        for skey in astute['BOOTSTRAP'].iterkeys():
+            # FIXME: astute.yaml repos point to public ones instead of
+            # local mirrors, this filter should be removed when in sync
+            if skey != 'repos':
+                fuel_bootstrap_cli[skey] = astute['BOOTSTRAP'][skey]
+    return fuel_bootstrap_cli
+
 def main():
     dea_file = parse_arguments()
     check_file_exists(ASTUTE_YAML)
+    check_file_exists(FUEL_BOOTSTRAP_CLI_YAML)
     dea = DeploymentEnvironmentAdapter(dea_file)
     log('Reading astute file %s' % ASTUTE_YAML)
     with io.open(ASTUTE_YAML) as stream:
@@ -92,7 +103,14 @@ def main():
     transplant(dea, astute)
     with io.open(ASTUTE_YAML, 'w') as stream:
         yaml.dump(astute, stream, default_flow_style=False)
-    log('Transplant done')
+    log('Transplant done for astute.yaml')
+    # Update bootstrap config yaml with info from DEA/astute.yaml
+    with io.open(FUEL_BOOTSTRAP_CLI_YAML) as stream:
+        fuel_bootstrap_cli = yaml.load(stream)
+    transplant_bootstrap(astute, fuel_bootstrap_cli)
+    with io.open(FUEL_BOOTSTRAP_CLI_YAML, 'w') as stream:
+        yaml.dump(fuel_bootstrap_cli, stream, default_flow_style=False)
+    log('Transplant done for fuel_bootstrap_cli.yaml')
 
 
 if __name__ == '__main__':
#39;/api/v2/yardstick/testcases/<case_name>', 'v2_testcase'), Url('/api/v2/yardstick/testsuites', 'v2_testsuites'), Url('/api/v2/yardstick/testsuites/action', 'v2_testsuites'), Url('/api/v2/yardstick/testsuites/<suite_name>', 'v2_testsuite') ]