pkgdep/rhel: Ignore subscription-manager failures

It seems that RHEL systems can be actively used without an actual
subscription. Since we don't really want to bother with this side
of the system, simply ignore all subscription-manager's failures.

See https://github.com/spdk/spdk/issues/1542 as a reference.

Change-Id: I76a58cb38bb77b3b6deb12e0cc8ccca5f883d5a7
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4360
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Michal Berger 2020-09-23 20:32:28 +02:00 committed by Tomasz Zawadzki
parent 0cd90081c0
commit e1ac33d8b3

View File

@ -16,6 +16,9 @@ disclaimer() {
# Don't trigger errexit, simply install what's available. This is default
# behavior of older yum versions (e.g. the one present on RHEL 7.x) anyway.
yum() { "$(type -P yum)" --skip-broken "$@"; }
# For systems which are not registered, subscription-manager will most likely
# fail on most calls so simply ignore its failures.
sub() { subscription-manager "$@" || :; }
;;
*) ;;
@ -52,8 +55,8 @@ if [[ $ID == centos || $ID == rhel ]]; then
fi
# Potential dependencies can be needed from other RHEL repos, enable them
if [[ $ID == rhel ]]; then
[[ $VERSION_ID == 7* ]] && subscription-manager repos --enable "rhel-*-optional-rpms" --enable "rhel-*-extras-rpms"
[[ $VERSION_ID == 8* ]] && subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms
[[ $VERSION_ID == 7* ]] && sub repos --enable "rhel-*-optional-rpms" --enable "rhel-*-extras-rpms"
[[ $VERSION_ID == 8* ]] && sub repos --enable codeready-builder-for-rhel-8-x86_64-rpms
fi
fi