teaching Apex builder to install multiple RPMs 07/6407/6
authorDan Radez <dradez@redhat.com>
Tue, 12 Jan 2016 16:10:44 +0000 (11:10 -0500)
committerDan Radez <dradez@redhat.com>
Fri, 15 Jan 2016 04:02:15 +0000 (23:02 -0500)
Change-Id: I10f462497de58319048e8a0feb6ed29257d64453
Signed-off-by: Dan Radez <dradez@redhat.com>
jjb/apex/apex.yml

index e6d196a..57825ce 100644 (file)
 
             source opnfv.properties
             RPM_INSTALL_PATH=build_output/$(basename $OPNFV_RPM_URL)
+            if [ ! -e "$RPM_INSTALL_PATH" ]; then
+               RPM_INSTALL_PATH=http://${OPNFV_RPM_URL}
+            fi
+
+            RPM_LIST=$RPM_INSTALL_PATH
+            for pkg in common undercloud; do
+                RPM_LIST+=" ${RPM_INSTALL_PATH/opnfv-apex/opnfv-apex-${pkg}}"
+            done
 
             # update / install the new rpm
             if rpm -q opnfv-apex > /dev/null; then
                if [ $(basename $OPNFV_RPM_URL) == $(rpm -q opnfv-apex).rpm ]; then
                  echo "RPM is already installed"
-               elif sudo yum update -y $RPM_INSTALL_PATH | grep "does not update installed package"; then
-                   sudo yum downgrade -y $RPM_INSTALL_PATH;
+               elif sudo yum update -y $RPM_LIST | grep "does not update installed package"; then
+                   if ! sudo yum downgrade -y $RPM_LIST; then
+                     yum remove -y opnfv-undercloud opnfv-common
+                     sudo yum downgrade -y $RPM_INSTALL_PATH
+                   fi
                fi
             else
-               sudo yum install -y $RPM_INSTALL_PATH;
+               sudo yum install -y $RPM_LIST;
             fi
 
             # cleanup virtual machines before we start
                RPM_INSTALL_PATH=http://${OPNFV_RPM_URL}
             fi
 
+            RPM_LIST=$RPM_INSTALL_PATH
+            for pkg in common undercloud; do
+                RPM_LIST+=" ${RPM_INSTALL_PATH/opnfv-apex/opnfv-apex-${pkg}}"
+            done
+
             # update / install the new rpm
             if rpm -q opnfv-apex > /dev/null; then
                if [ $(basename $OPNFV_RPM_URL) == $(rpm -q opnfv-apex).rpm ]; then
                  echo "RPM is already installed"
-               elif sudo yum update -y $RPM_INSTALL_PATH | grep "does not update installed package"; then
-                   sudo yum downgrade -y $RPM_INSTALL_PATH;
+               elif sudo yum update -y $RPM_LIST | grep "does not update installed package"; then
+                   if ! sudo yum downgrade -y $RPM_LIST; then
+                     yum remove -y opnfv-undercloud opnfv-common
+                     sudo yum downgrade -y $RPM_INSTALL_PATH
+                   fi
                fi
             else
-               sudo yum install -y $RPM_INSTALL_PATH;
+               sudo yum install -y $RPM_LIST;
             fi
 
             # cleanup environment before we start