Merge "refactor apex installer"
authorRyota Mibu <r-mibu@cq.jp.nec.com>
Wed, 9 Aug 2017 02:46:52 +0000 (02:46 +0000)
committerGerrit Code Review <gerrit@opnfv.org>
Wed, 9 Aug 2017 02:46:52 +0000 (02:46 +0000)
tests/lib/installers/apex
tests/run.sh

index 3d94e1c..f7b9624 100644 (file)
@@ -44,13 +44,14 @@ function installer_apply_patches {
             fi
 
             co_conf=/etc/congress/congress.conf
+            co_conf_bak=/etc/congress/congress.conf.bak
             co_entry="congress.datasources.doctor_driver.DoctorDriver"
             if sudo grep -e "^drivers.*$co_entry" $co_conf; then
                 echo "NOTE: congress is configured as we needed"
             else
                 echo "modify the congress config"
-                sudo sed -i -e "/^drivers/s/$/,$co_entry    # added by doctor script/" \
-                    $co_conf
+                sudo cp $co_conf $co_conf_bak
+                sudo sed -i -e "/^drivers/s/$/,$co_entry/"  $co_conf
                 sudo systemctl restart openstack-congress-server.service
             fi
             ' > installer_apply_patches_$node.log 2>&1
@@ -90,10 +91,10 @@ function installer_revert_patches {
             date
 
             co_conf=/etc/congress/congress.conf
-            co_entry="congress.datasources.doctor_driver.DoctorDriver"
-            if sudo grep -q -e "# added by doctor script" $co_conf; then
-                echo "modify the congress config"
-                sudo sed -i -e "/^drivers/s/^\(.*\),$co_entry    # added by doctor script/\1/" $co_conf
+            co_conf_bak=/etc/congress/congress.conf.bak
+            if [ -e $co_conf_bak ]; then
+                echo "restore the congress config"
+                sudo mv $co_conf_bak $co_conf
                 sudo systemctl restart openstack-congress-server.service
             fi
 
index 5c92226..abdad58 100755 (executable)
@@ -478,6 +478,13 @@ cleanup() {
     done
 }
 
+setup_python_packages() {
+    sudo pip install flask==0.10.1
+    command -v openstack || sudo pip install python-openstackclient==2.3.0
+    command -v ceilometer || sudo pip install python-ceilometerclient==2.6.2
+    command -v congress || sudo pip install python-congressclient==1.5.0
+}
+
 # Main process
 
 if [[ $PYTHON_ENABLE == [Tt]rue ]]; then
@@ -499,6 +506,8 @@ git log --oneline -1 || true   # ignore even you don't have git installed
 
 trap cleanup EXIT
 
+setup_python_packages
+
 source $TOP_DIR/functions-common
 source $TOP_DIR/lib/installer
 source $TOP_DIR/lib/inspector