From 32a655feb6a9af5455b36a7f987dcd3030ffc220 Mon Sep 17 00:00:00 2001
From: Narinder Gupta <narinder.gupta@canonical.com>
Date: Wed, 25 Jan 2017 12:41:32 -0600
Subject: recover MAAS 2.0

code has been modified to recover the environment for MAAS 2.0 as
new deployment failed for MAAS 2.0

Change-Id: I80a0fab8f01a5600b04c7e95509f88617783215e
Signed-off-by: Narinder Gupta <narinder.gupta@canonical.com>
---
 jjb/joid/joid-deploy.sh | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

(limited to 'jjb')

diff --git a/jjb/joid/joid-deploy.sh b/jjb/joid/joid-deploy.sh
index 88dbe2214..da5dcf043 100644
--- a/jjb/joid/joid-deploy.sh
+++ b/jjb/joid/joid-deploy.sh
@@ -45,17 +45,24 @@ export POD_NAME=${POD/-}
 ##
 
 cd $WORKSPACE/ci
-if [ -e "$LAB_CONFIG/environments.yaml" ] && [ "$MAAS_REINSTALL" == "false" ]; then
+
+if [ -e "$LAB_CONFIG/deployconfig.yaml" ] && [ "$MAAS_REINSTALL" == "false" ]; then
     echo "------ Recover Juju environment to use MAAS ------"
-    cp $LAB_CONFIG/environments.yaml .
-    cp $LAB_CONFIG/deployment.yaml .
-    if [ -e $LAB_CONFIG/deployconfig.yaml ]; then
+    if [ -e deployconfig.yaml ]; then
         cp $LAB_CONFIG/deployconfig.yaml .
+        cp $LAB_CONFIG/deployment.yaml .
+        cp $LAB_CONFIG/labconfig.yaml .
     fi
 else
-    echo "------ Redeploy MAAS ------"
-    ./00-maasdeploy.sh $POD_NAME
-    exit_on_error $? "MAAS Deploy FAILED"
+    if ["$NODE_NAME" == "default" ]; then
+        echo "------ Redeploy MAAS ------"
+        ./03-maasdeploy.sh default
+        exit_on_error $? "MAAS Deploy FAILED"
+    else
+        echo "------ Redeploy MAAS ------"
+        ./03-maasdeploy.sh custom $LAB_CONFIG/labconfig.yaml
+        exit_on_error $? "MAAS Deploy FAILED"
+    fi
 fi
 
 ##
@@ -142,7 +149,7 @@ if [ "$JOID_MODEL" == 'os' ]; then
 
   # export the openrc file by getting the one generated by joid and add SDN
   # controller for Functest
-  cp ./cloud/admin-openrc $JOID_ADMIN_OPENRC
+  # cp ./cloud/admin-openrc $JOID_ADMIN_OPENRC
   cat << EOF >> $JOID_ADMIN_OPENRC
   export SDN_CONTROLLER=$SDN_CONTROLLER_IP
   export SDN_PASSWORD=$SDN_PASSWORD
-- 
cgit