Fix some opera related error 99/32199/1
authorHarry Huang <huangxiangyu5@huawei.com>
Wed, 29 Mar 2017 09:30:15 +0000 (17:30 +0800)
committerHarry Huang <huangxiangyu5@huawei.com>
Wed, 29 Mar 2017 10:03:19 +0000 (18:03 +0800)
1. echo a string to compass log to avoid deploy error
bing concealed
2. judge return code of ./opera_launch.sh

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

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 5f1ee1c..51094b2 100755 (executable)
@@ -142,8 +142,11 @@ echo "NOTE: openrc file is in the controller nodes"
 echo ""
 
 if [[ ${DHA##*/} =~ "openo" ]]; then
-    sudo python ${COMPASS_DIR}/deploy/opera_adapter.py $DHA $NETWORK
+    python ${COMPASS_DIR}/deploy/opera_adapter.py $DHA $NETWORK
     if [[ $? -ne 0 ]]; then
+        log_error 'opera launch failed'
         exit 1
     fi
 fi
+
+echo 'compass deploy success'
index 71f1995..137aba5 100644 (file)
@@ -76,14 +76,14 @@ if __name__ == "__main__":
     compass_dir = os.getenv('COMPASS_DIR')
 
     if not compass_dir:
-        print("env var COMPASS_DIR  doesn't exit")
+        print("env var COMPASS_DIR  doesn't exist")
         sys.exit(1)
 
     if not os.path.exists(dha_file):
-        print("DHA file doesn't exit")
+        print("DHA file doesn't exist")
         sys.exit(1)
     if not os.path.exists(network_file):
-        print("NETWORK file doesn't exit")
+        print("NETWORK file doesn't exist")
         sys.exit(1)
 
     dha = load_file(dha_file)
@@ -121,3 +121,6 @@ if __name__ == "__main__":
 
     p2 = subprocess.Popen("./opera_launch.sh", cwd=opera_dir, shell=True)
     p2.communicate()
+    if p2.returncode != 0:
+        print('./opera_launch.sh fail')
+        sys.exit(1)
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