Disabling all previous repos registered in the system

Depending on the pool id used, so many repos are brought,
including not valid ones that cause image to crash, or repos
that include conflicting packages.
Before enabling repos, disable all previous ones, so we
can be sure that we only bring the repos specified in the
parameters.

Change-Id: Ifd4d8d1d4fa954cd2593669e516e3201f2d6f6c1
This commit is contained in:
Yolanda Robla Mota 2016-09-27 10:09:35 +02:00
parent ca53af1184
commit c6b4e639b0

View File

@ -97,6 +97,8 @@ case "${REG_METHOD:-}" in
echo "Attaching with options: $attach_opts" echo "Attaching with options: $attach_opts"
subscription-manager attach $attach_opts subscription-manager attach $attach_opts
fi fi
echo "Disabling all previous repos"
subscription-manager repos --disable=\*
echo "Enabling repos: $repos" echo "Enabling repos: $repos"
subscription-manager $repos subscription-manager $repos
;; ;;
@ -108,6 +110,8 @@ case "${REG_METHOD:-}" in
rpm -Uvh "$REG_SAT_URL/pub/katello-ca-consumer-latest.noarch.rpm" || true rpm -Uvh "$REG_SAT_URL/pub/katello-ca-consumer-latest.noarch.rpm" || true
echo "Registering with options: $sanitized_opts" echo "Registering with options: $sanitized_opts"
subscription-manager register $opts subscription-manager register $opts
echo "Disabling all previous repos"
subscription-manager repos --disable=\*
echo "Enabling repos: $user_repos" echo "Enabling repos: $user_repos"
subscription-manager $repos subscription-manager $repos
echo "Disabling satellite repo because it is no longer needed" echo "Disabling satellite repo because it is no longer needed"