From: Tim Rozet Date: Thu, 26 May 2016 01:06:45 +0000 (-0400) Subject: Apex: Fixes RPM checking in virtual deployment X-Git-Tag: colorado.1.0~444 X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F83%2F14683%2F1;p=releng.git Apex: Fixes RPM checking in virtual deployment Change-Id: I2e02f16173ec495e250bc60bc225ad1bb6a91828 Signed-off-by: Tim Rozet --- diff --git a/jjb/apex/apex-deploy-virtual.sh b/jjb/apex/apex-deploy-virtual.sh index c7fb17e8c..4d9b03088 100755 --- a/jjb/apex/apex-deploy-virtual.sh +++ b/jjb/apex/apex-deploy-virtual.sh @@ -92,27 +92,30 @@ if [[ $BUILD_DIRECTORY == *verify-master* ]]; then export PYTHONPATH=$PYTHONPATH:${WORKSPACE}/lib/python fi else - VERSION_EXTENSION=$(echo $(basename $RPM_LIST) | sed 's/opnfv-apex-//') + VERSION_EXTENSION=$(echo $(basename $RPM_LIST) | grep -Eo '[0-9]+\.[0-9]+-[0-9]{8}') for pkg in common undercloud opendaylight-sfc onos; do - RPM_LIST+=" ${RPM_INSTALL_PATH}/opnfv-apex-${pkg}-${VERSION_EXTENSION}" + RPM_LIST+=" ${RPM_INSTALL_PATH}/opnfv-apex-${pkg}-${VERSION_EXTENSION}.noarch.rpm" done # update / install the new rpm if rpm -q opnfv-apex > /dev/null; then INSTALLED_RPMS=$(rpm -qa | grep apex) for x in $INSTALLED_RPMS; do - INSTALLED_RPM_VER=$(echo $x | sed 's/opnfv-apex-//').rpm + INSTALLED_RPM_VER=$(echo $x | grep -Eo '[0-9]+\.[0-9]+-[0-9]{8}') # Does each RPM's version match the version required for deployment if [ "$INSTALLED_RPM_VER" == "$VERSION_EXTENSION" ]; then echo "RPM $x is already installed" else - echo "RPM $x does not match $VERSION_EXTENSION" + echo "RPM $x does not match version $VERSION_EXTENSION" echo "Will upgrade/downgrade RPMs..." # Try to upgrade/downgrade RPMS if sudo yum update -y $RPM_LIST | grep "does not update installed package"; then if ! sudo yum downgrade -y $RPM_LIST; then sudo yum remove -y opnfv-apex-undercloud opnfv-apex-common opnfv-apex-opendaylight-sfc opnfv-apex-onos - sudo yum downgrade -y $RPM_INSTALL_PATH + if ! sudo yum downgrade -y $RPM_LIST; then + echo "Unable to downgrade RPMs: $RPM_LIST" + exit 1 + fi fi fi break