opera adapter fix2 09/31509/4
authorHarry Huang <huangxiangyu5@huawei.com>
Thu, 23 Mar 2017 07:52:09 +0000 (15:52 +0800)
committerHarry Huang <huangxiangyu5@huawei.com>
Mon, 27 Mar 2017 06:29:28 +0000 (14:29 +0800)
* opera_adapter need sshpass which may cause deploy
fail
* compass log redirection is the last command which
always return 0 and thus cover deploy error

1. add installation of sshpass in prepare.sh
2. echo a string at the end of deploy/launch.sh into
log file to judge if deployment is complete
3. fix typing error in util/check_valid.py

Change-Id: Ic4bca50b2c316bf46cace45b9b3317ef9452a0ba
Signed-off-by: Harry Huang <huangxiangyu5@huawei.com>
deploy.sh
deploy/launch.sh
deploy/opera_adapter.py
deploy/prepare.sh
util/check_valid.py

index 891eadf..e29b518 100755 (executable)
--- a/deploy.sh
+++ b/deploy.sh
@@ -39,6 +39,12 @@ if [[ -z $DEPLOY_COMPASS && -z $DEPLOY_HOST && -z $REDEPLOY_HOST ]]; then
 fi
 
 LOG_DIR=$COMPASS_DIR/work/deploy/log
+export LOG_DIR
+
 mkdir -p $LOG_DIR
 
 $COMPASS_DIR/deploy/launch.sh $* 2>&1 | tee $LOG_DIR/compass-deploy.log
+
+if [[ $(tail -1 $LOG_DIR/compass-deploy.log) != 'compass deploy success' ]]; then
+    exit 1
+fi
index 51b502f..51094b2 100755 (executable)
@@ -148,3 +148,5 @@ if [[ ${DHA##*/} =~ "openo" ]]; then
         exit 1
     fi
 fi
+
+echo 'compass deploy success'
index f83638d..137aba5 100644 (file)
@@ -119,7 +119,7 @@ if __name__ == "__main__":
     dump_file(openo_config, openo_config_file)
     sync_admin_openrc(network, admin_openrc_file)
 
-    p2 = subprocess.Popen("sudo ./opera_launch.sh", cwd=opera_dir, shell=True)
+    p2 = subprocess.Popen("./opera_launch.sh", cwd=opera_dir, shell=True)
     p2.communicate()
     if p2.returncode != 0:
         print('./opera_launch.sh fail')
index c202322..b7e5bfa 100755 (executable)
@@ -74,7 +74,7 @@ function  _prepare_python_env() {
         else
              sudo apt-get update -y
              sudo apt-get install -y --force-yes mkisofs bc curl ipmitool openvswitch-switch
-             sudo apt-get install -y --force-yes git python-dev python-pip figlet
+             sudo apt-get install -y --force-yes git python-dev python-pip figlet sshpass
              sudo apt-get install -y --force-yes libxslt-dev libxml2-dev libvirt-dev build-essential qemu-utils qemu-kvm libvirt-bin virtinst libmysqld-dev
              sudo apt-get install -y --force-yes libffi-dev libssl-dev
 
index 9eaa100..e3ad6bc 100644 (file)
@@ -135,7 +135,7 @@ if __name__ == "__main__":
     _, dha_file, network_file = sys.argv
 
     if not os.path.exists(dha_file):
-        err_print("DHA file doesn't exit")
+        err_print("DHA file doesn't exist")
         sys.exit(1)
     else:
         dha = load_file(dha_file)
@@ -148,7 +148,7 @@ if __name__ == "__main__":
                 has_invalid = True
 
     if not os.path.exists(network_file):
-        err_print("NETWORK file doesn't exit")
+        err_print("NETWORK file doesn't exist")
         sys.exit(1)
     else:
         network = load_file(network_file)