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