fuel, armband: Remove SALT_MASTER_IP param 83/41483/2
authorAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Sun, 10 Sep 2017 19:34:32 +0000 (21:34 +0200)
committerAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Mon, 11 Sep 2017 17:57:50 +0000 (17:57 +0000)
Fuel@OPNFV mcpcontrol network (equiv to old admin/PXE net) has been
configured to use 192.168.10.0/24 during E release cycle.
However, due to overlapping with Ericsson-pod1 networks, we decided
to re-use the old CIDR Fuel used before E release (10.20.0.0/24).

This allows reusing the INSTALLER_IP param instead of recently added
SALT_MASTER_IP param.

Current change refactors all usage of SALT_MASTER_IP in favor of old
INSTALLER_IP, thus reducing complexity and providing a familiar env
to leagcy Fuel users.

JIRA: FUEL-285

Change-Id: I1e89cca08ce4cb9bf3a82a06043c91ee26aa0794
Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
jjb/functest/set-functest-env.sh
jjb/global/installer-params.yml
utils/fetch_os_creds.sh

index f18f054..bb79dac 100755 (executable)
@@ -51,14 +51,15 @@ envs="-e INSTALLER_TYPE=${INSTALLER_TYPE} -e INSTALLER_IP=${INSTALLER_IP} \
     -e NODE_NAME=${NODE_NAME} -e DEPLOY_SCENARIO=${DEPLOY_SCENARIO} \
     -e BUILD_TAG=${BUILD_TAG} -e CI_DEBUG=${CI_DEBUG} -e DEPLOY_TYPE=${DEPLOY_TYPE}"
 
-if [[ ${INSTALLER_TYPE} == 'fuel' && ! -z ${SALT_MASTER_IP} ]]; then
-  HOST_ARCH=$(ssh -l ubuntu ${SALT_MASTER_IP} -i ${SSH_KEY} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \
-  "sudo salt 'cmp*' grains.get cpuarch --out yaml |awk '{print \$2; exit}'")
-  envs="${envs} -e POD_ARCH=${HOST_ARCH}"
+ssh_options="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
+
+if [ "${INSTALLER_TYPE}" == 'fuel' ] && [ "$BRANCH" != 'stable/danube' ]; then
+    COMPUTE_ARCH=$(ssh -l ubuntu ${INSTALLER_IP} -i ${SSH_KEY} ${ssh_options} \
+        "sudo salt 'cmp*' grains.get cpuarch --out yaml | awk '{print \$2; exit}'")
+    envs="${envs} -e POD_ARCH=${COMPUTE_ARCH}"
 fi
 
 if [[ ${INSTALLER_TYPE} == 'compass' && ${DEPLOY_SCENARIO} == *'os-nosdn-openo-ha'* ]]; then
-    ssh_options="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
     openo_msb_port=${openo_msb_port:-80}
     openo_msb_endpoint="$(sshpass -p'root' ssh 2>/dev/null $ssh_options root@${installer_ip} \
     'mysql -ucompass -pcompass -Dcompass -e "select package_config from cluster;" \
index b64a41e..8c01a9f 100644 (file)
           name: INSTALLER_IP
           default: '10.20.0.2'
           description: 'IP of the installer'
-      - string:
-          name: SALT_MASTER_IP
-          default: '192.168.10.100'
-          description: 'IP of the salt master (for mcp deployments)'
       - string:
           name: SSH_KEY
           default: "/var/lib/opnfv/mcp.rsa"
index 3bc66f9..0873a68 100755 (executable)
@@ -74,9 +74,6 @@ dest_path=${dest_path:-$HOME/opnfv-openrc.sh}
 os_cacert=${os_cacert:-$HOME/os_cacert}
 installer_type=${installer_type:-$INSTALLER_TYPE}
 installer_ip=${installer_ip:-$INSTALLER_IP}
-if [ "${installer_type}" == "fuel" ] && [ "${BRANCH}" == "master" ]; then
-    installer_ip=${SALT_MASTER_IP}
-fi
 
 if [ -z $dest_path ] || [ -z $installer_type ] || [ -z $installer_ip ]; then
     usage
@@ -97,28 +94,31 @@ ssh_options="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
 # Start fetching the files
 info "Fetching rc file..."
 if [ "$installer_type" == "fuel" ]; then
-    verify_connectivity $installer_ip
-    if [ "${BRANCH}" == "master" ]; then
-        ssh_key=${ssh_key:-$SSH_KEY}
-        if [ -z $ssh_key ] || [ ! -f $ssh_key ]; then
+    verify_connectivity "${installer_ip}"
+    # stable/danube uses old Fuel, requires user/pass; new Fuel uses keypair
+    if [[ ! "${BRANCH}" =~ "danube" ]]; then
+        ssh_user="ubuntu"
+        ssh_key="${ssh_key:-$SSH_KEY}"
+        if [ -z "$ssh_key" ] || [ ! -f "$ssh_key" ]; then
             error "Please provide path to existing ssh key for mcp deployment."
             exit 2
         fi
         ssh_options+=" -i ${ssh_key}"
 
         # retrieving controller vip
-        controller_ip=$(ssh 2>/dev/null ${ssh_options} ubuntu@${installer_ip} \
-            "sudo salt --out txt 'ctl*' pillar.get _param:openstack_control_address | awk '{print \$2; exit}'" | \
-            sed 's/ //g') &> /dev/null
+        controller_ip=$(ssh 2>/dev/null ${ssh_options} "${ssh_user}@${installer_ip}" \
+            "sudo salt --out yaml 'ctl*' pillar.get _param:openstack_control_address | \
+                awk '{print \$2; exit}'") &> /dev/null
 
-        info "... from controller $controller_ip..."
-        ssh ${ssh_options} ubuntu@${controller_ip} "sudo cat /root/keystonercv3" > $dest_path
+        info "... from controller ${controller_ip} ..."
+        ssh ${ssh_options} "${ssh_user}@${controller_ip}" \
+            "sudo cat /root/keystonercv3" > "${dest_path}"
 
-        if [[ $BUILD_TAG =~ "baremetal" ]]; then
-            ssh ${ssh_options} ubuntu@${installer_ip} "cat /etc/ssl/certs/os_cacert" > $os_cacert
+        if [[ "${BUILD_TAG}" =~ "baremetal" ]]; then
+            ssh ${ssh_options} "${ssh_user}@${installer_ip}" \
+                "cat /etc/ssl/certs/os_cacert" > "${os_cacert}"
         fi
     else
-        #ip_fuel="10.20.0.2"
         env=$(sshpass -p r00tme ssh 2>/dev/null ${ssh_options} root@${installer_ip} \
             'fuel env'|grep operational|head -1|awk '{print $1}') &> /dev/null
         if [ -z $env ]; then