Decoupling prepare_env.sh and load_images.sh 57/25057/2
authorJingLu5 <lvjing5@huawei.com>
Tue, 29 Nov 2016 02:50:40 +0000 (10:50 +0800)
committerJingLu5 <lvjing5@huawei.com>
Tue, 29 Nov 2016 03:01:16 +0000 (11:01 +0800)
JIRA: YARDSTICK-430

The "prepare_env.sh" and “load_images.sh” have serious dependency.
The “load_images.sh” uses the "YARD_IMG_ARCH" variable which is defined in
the "prepare_env.sh" to choose the base ubuntu image version.
We want to decoupling these two scripts, so they can be invoked separately.

Change-Id: I30c1b4a65f73b1550fa5eb96366fe8b1d59251d7
Signed-off-by: JingLu5 <lvjing5@huawei.com>
tests/ci/load_images.sh
tests/ci/prepare_env.sh

index 54a145f..405d720 100755 (executable)
 
 set -e
 
+YARD_IMG_ARCH=amd64
+export YARD_IMG_ARCH
+
+if ! grep -q "Defaults env_keep += \"YARD_IMG_ARCH\"" "/etc/sudoers"; then
+    sudo echo "Defaults env_keep += \"YARD_IMG_ARCH YARDSTICK_REPO_DIR\"" >> /etc/sudoers
+fi
+
+ARCH_SCRIPT="test -f /etc/fuel_openstack_arch && grep -q arm64 /etc/fuel_openstack_arch"
+if [ "$INSTALLER_TYPE" == "fuel" ]; then
+    sshpass -p r00tme ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -l root $INSTALLER_IP "${ARCH_SCRIPT}" && YARD_IMG_ARCH=arm64
+fi
+
 UCA_HOST="cloud-images.ubuntu.com"
 if [ $YARD_IMG_ARCH = "arm64" ]; then
     export VIVID_IMG_URL="http://${UCA_HOST}/vivid/current/vivid-server-cloudimg-arm64.tar.gz"
index 130969f..be59b7f 100755 (executable)
@@ -74,13 +74,6 @@ verify_connectivity() {
     error "Can not talk to $ip."
 }
 
-YARD_IMG_ARCH=amd64
-export YARD_IMG_ARCH
-
-if ! grep -q "Defaults env_keep += \"YARD_IMG_ARCH\"" "/etc/sudoers"; then
-    sudo echo "Defaults env_keep += \"YARD_IMG_ARCH YARDSTICK_REPO_DIR\"" >> /etc/sudoers
-fi
-
 ssh_options="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
 
 if [ "$INSTALLER_TYPE" == "fuel" ]; then
@@ -90,9 +83,6 @@ if [ "$INSTALLER_TYPE" == "fuel" ]; then
     sshpass -p r00tme scp 2>/dev/null $ssh_options \
     root@${INSTALLER_IP}:~/.ssh/id_rsa /root/.ssh/id_rsa &> /dev/null
 
-    ARCH_SCRIPT="test -f /etc/fuel_openstack_arch && grep -q arm64 /etc/fuel_openstack_arch"
-    sshpass -p r00tme ssh $ssh_options -l root $INSTALLER_IP "${ARCH_SCRIPT}" && YARD_IMG_ARCH=arm64
-
     sshpass -p r00tme ssh 2>/dev/null $ssh_options \
         root@${INSTALLER_IP} fuel node>fuel_node