summaryrefslogtreecommitdiffstats
path: root/ci/deploy
diff options
context:
space:
mode:
authorZhijiang Hu <hu.zhijiang@zte.com.cn>2017-08-09 02:17:19 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-08-09 02:17:19 +0000
commit62db6264951f84811b5fb29361078f7d4a1ce493 (patch)
tree8b0b87f8cbf38619cb49778d6fbb10247353fca9 /ci/deploy
parent257e378a4efcc23d9d24ade17ec098c8de53e6de (diff)
parentbd241b3bdc1f7494cd8bb7fc120155c8b1cb305f (diff)
Merge "Use PDF(POD descriptor file) and correct the mapping of nodes and roles"
Diffstat (limited to 'ci/deploy')
-rwxr-xr-xci/deploy/deploy.sh34
1 files changed, 34 insertions, 0 deletions
diff --git a/ci/deploy/deploy.sh b/ci/deploy/deploy.sh
index 31382623..9360da85 100755
--- a/ci/deploy/deploy.sh
+++ b/ci/deploy/deploy.sh
@@ -173,6 +173,40 @@ done
BMDEPLOY_DAISY_SERVER_NET=$WORKSPACE/templates/physical_environment/networks/daisy.xml
BMDEPLOY_DAISY_SERVER_VM=$WORKSPACE/templates/physical_environment/vms/daisy.xml
+function update_dha_by_pdf()
+{
+ local pdf_yaml=securedlab/labs/$LAB_NAME/${POD_NAME}.yaml
+ local jinja2_template=securedlab/installers/daisy/pod_config.yaml.j2
+ local generate_config=securedlab/utils/generate_config.py
+ if [ ! -f ${generate_config} ] || [ ! -f ${pdf_yaml} ] || [ ! -f ${jinja2_template} ]; then
+ return
+ fi
+
+ local tmpfile=$(mktemp XXXXXXXX.yml)
+ python ${generate_config} -j ${jinja2_template} -y ${pdf_yaml} > ${tmpfile}
+ if [ $? -ne 0 ]; then
+ echo "Cannot generate config from POD Descriptor File, use original deploy.yml !"
+ return
+ fi
+ if [ -z $(awk "BEGIN{}(/daisy_ip/){print NR}" $tmpfile) ]; then
+ line=$(awk "BEGIN{}(/daisy_gateway/){print NR}" $tmpfile)
+ sed -i "${line}b\daisy_ip: $INSTALLER_IP" $tmpfile
+ fi
+ if [ $? -ne 0 ]; then
+ echo "Cannot write INSTALLER_IP to config file, use original deploy.yml !"
+ return
+ fi
+ cp ${tmpfile} ${DHA_CONF}
+ echo "====== Update deploy.yml from POD Descriptor File ======"
+ rm -f $tmpfile
+}
+
+if [[ ! -z $INSTALLER_IP ]]; then
+ pushd ${WORKSPACE}
+ update_dha_by_pdf
+ popd
+fi
+
PARAS_FROM_DEPLOY=`python $WORKSPACE/deploy/get_conf.py --dha $DHA_CONF`
TARGET_HOSTS_NUM=`echo $PARAS_FROM_DEPLOY | cut -d " " -f 1`
DAISY_IP=`echo $PARAS_FROM_DEPLOY | cut -d " " -f 2`