From 4aa264aa97b81f2b40434da55745b4ade4a8a2ab Mon Sep 17 00:00:00 2001 From: Tim Rozet Date: Wed, 25 May 2016 21:06:45 -0400 Subject: [PATCH] Apex: Fixes RPM checking in virtual deployment Change-Id: I2e02f16173ec495e250bc60bc225ad1bb6a91828 Signed-off-by: Tim Rozet --- jjb/apex/apex-deploy-virtual.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) 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 -- 2.16.6