summaryrefslogtreecommitdiffstats
path: root/deploy/deploy.py
diff options
context:
space:
mode:
authorzhongjun <zhong.jun@zte.com.cn>2017-06-26 11:16:15 +0800
committerzhongjun <zhong.jun@zte.com.cn>2017-06-27 10:01:28 +0800
commit180cda99be47c1c4cc05844fb8feeeed96e0f3aa (patch)
treed4c4c31aed246ee7b85bd040e2c3d9486eb5657f /deploy/deploy.py
parent7795fc14f129a2c37607aa965d63e5831099681b (diff)
Adapt the scenario arg add in tempset.py
1.adapt the scenario argument add in tempset.py, detail please refer to https://gerrit.opnfv.org/gerrit/#/c/36229/5/deploy/tempest.py. 2.bugfix to update the self.deploy_file with the constructed final deploy file in deoploy.py. Change-Id: Ia46720649a2361f0b84749925d2c0dede78ccdb5 Signed-off-by: zhongjun <zhong.jun@zte.com.cn>
Diffstat (limited to 'deploy/deploy.py')
-rw-r--r--deploy/deploy.py29
1 files changed, 24 insertions, 5 deletions
diff --git a/deploy/deploy.py b/deploy/deploy.py
index 88a5cba6..47549b43 100644
--- a/deploy/deploy.py
+++ b/deploy/deploy.py
@@ -20,6 +20,8 @@
import argparse
import yaml
+import time
+import os
from config.schemas import (
@@ -53,11 +55,14 @@ class DaisyDeployment(object):
self.lab_name = lab_name
self.pod_name = pod_name
- self.deploy_file = deploy_file
- self.deploy_struct = self._consturct_final_deploy_conf(deploy_file, scenario)
+ self.src_deploy_file = deploy_file
+ self.scenario = scenario
+ self.deploy_struct = self._construct_final_deploy_conf(deploy_file, scenario)
+ self.deploy_file, self.deploy_file_name = self._construct_final_deploy_file(self.deploy_struct, work_dir)
if not cleanup_only:
self.net_file = net_file
+ self.net_file_name = os.path.basename(net_file)
with open(net_file) as yaml_file:
self.net_struct = yaml.safe_load(yaml_file)
else:
@@ -94,7 +99,9 @@ class DaisyDeployment(object):
self.pxe_bridge,
self.daisy_server_info,
self.work_dir,
- self.storage_dir)
+ self.storage_dir,
+ self.scenario)
+ return
def _get_adapter_info(self):
default_adapter = 'libvirt' if 'virtual' in self.pod_name else 'ipmi'
@@ -116,7 +123,7 @@ class DaisyDeployment(object):
'password': password,
'disk_size': disk_size}
- def _consturct_final_deploy_conf(self, deploy_file, scenario):
+ def _construct_final_deploy_conf(self, deploy_file, scenario):
with open(deploy_file) as yaml_file:
deploy_struct = yaml.safe_load(yaml_file)
scenario_file = path_join(WORKSPACE, 'deploy/scenario/scenario.yaml')
@@ -137,6 +144,17 @@ class DaisyDeployment(object):
deploy_struct['modules'] = modules
return deploy_struct
+ def _construct_final_deploy_file(self, deploy_infor, work_dir):
+ final_deploy_file_name = 'final_deploy.yml'
+ final_deploy_file = path_join(work_dir, 'final_deploy.yml')
+ with open(final_deploy_file, 'w') as f:
+ f.write("\n".join([("title: This file automatically generated"),
+ "created: " + str(time.strftime("%d/%m/%Y")) +
+ " " + str(time.strftime("%H:%M:%S")),
+ "comment: none\n"]))
+ yaml.dump(deploy_infor, f, default_flow_style=False)
+ return final_deploy_file, final_deploy_file_name
+
def run(self):
self.daisy_env.delete_old_environment()
if self.cleanup_only:
@@ -145,7 +163,8 @@ class DaisyDeployment(object):
if self.daisy_only:
log_bar('Create Daisy Server successfully !')
return
- self.daisy_env.install_daisy(self.remote_dir, self.bin_file)
+ self.daisy_env.install_daisy(self.remote_dir, self.bin_file,
+ self.deploy_file_name, self.net_file_name)
self.daisy_env.deploy(self.deploy_file, self.net_file)
log_bar('Daisy deploy successfully !')