Merge "Add Activation Key Support For Customer Portal"
This commit is contained in:
commit
ef0c043c85
@ -64,12 +64,20 @@ if [ -n "${REG_SERVER_URL:-}" ]; then
|
|||||||
opts="$opts --serverurl=$REG_SERVER_URL"
|
opts="$opts --serverurl=$REG_SERVER_URL"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${REG_USER:-}" ]; then
|
if [ -n "${REG_ACTIVATION_KEY:-}" ]; then
|
||||||
opts="$opts --username $REG_USER"
|
opts="$opts --activationkey=$REG_ACTIVATION_KEY"
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "${REG_PASSWORD:-}" ]; then
|
if [ -z "${REG_ORG:-}" ]; then
|
||||||
|
echo "WARNING: REG_ACTIVATION_KEY set without REG_ORG."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [ -n "${REG_PASSWORD:-}" ]; then
|
||||||
opts="$opts --password $REG_PASSWORD"
|
opts="$opts --password $REG_PASSWORD"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "${REG_USER:-}" ]; then
|
||||||
|
opts="$opts --username $REG_USER"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${REG_MACHINE_NAME:-}" ]; then
|
if [ -n "${REG_MACHINE_NAME:-}" ]; then
|
||||||
@ -79,18 +87,19 @@ fi
|
|||||||
if [ -n "${REG_ORG:-}" ]; then
|
if [ -n "${REG_ORG:-}" ]; then
|
||||||
opts="$opts --org $REG_ORG"
|
opts="$opts --org $REG_ORG"
|
||||||
fi
|
fi
|
||||||
case "${REG_METHOD:-}" in
|
|
||||||
portal)
|
|
||||||
if [ -n "${REG_ACTIVATION_KEY:-}" ]; then
|
|
||||||
echo "WARNING: Activation keys are not supported by the customer portal at this time."
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "${REG_REPOS:-}" ]; then
|
if [ -n "${REG_REPOS:-}" ]; then
|
||||||
for repo in $REG_REPOS; do
|
for repo in $REG_REPOS; do
|
||||||
repos="$repos --enable $repo"
|
repos="$repos --enable $repo"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -n "${REG_TYPE:-}" ]; then
|
||||||
|
opts="$opts --type=$REG_TYPE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "${REG_METHOD:-}" in
|
||||||
|
portal)
|
||||||
subscription-manager register $opts
|
subscription-manager register $opts
|
||||||
if [ -z "${REG_AUTO_ATTACH:-}" ]; then
|
if [ -z "${REG_AUTO_ATTACH:-}" ]; then
|
||||||
subscription-manager attach $attach_opts
|
subscription-manager attach $attach_opts
|
||||||
@ -99,12 +108,6 @@ case "${REG_METHOD:-}" in
|
|||||||
;;
|
;;
|
||||||
satellite)
|
satellite)
|
||||||
repos="$repos --enable ${satellite_repo}"
|
repos="$repos --enable ${satellite_repo}"
|
||||||
if [ -n "${REG_REPOS:-}" ]; then
|
|
||||||
for repo in $REG_REPOS; do
|
|
||||||
repos="$repos --enable $repo"
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
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
|
||||||
subscription-manager register $opts
|
subscription-manager register $opts
|
||||||
subscription-manager $repos
|
subscription-manager $repos
|
||||||
@ -115,5 +118,5 @@ case "${REG_METHOD:-}" in
|
|||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "WARNING: only 'portal' and 'satellite' are valid values for REG_METHOD."
|
echo "WARNING: only 'portal' and 'satellite' are valid values for REG_METHOD."
|
||||||
exit 0
|
exit 0 # keeps the stack from failing if you don't set a value in REG_METHOD
|
||||||
esac
|
esac
|
||||||
|
@ -5,6 +5,7 @@ set -o pipefail
|
|||||||
opts=
|
opts=
|
||||||
attach_opts=
|
attach_opts=
|
||||||
repos="repos --enable rhel-7-server-rpms"
|
repos="repos --enable rhel-7-server-rpms"
|
||||||
|
satellite_repo="rhel-7-server-rh-common-beta-rpms"
|
||||||
|
|
||||||
if [ -n "${REG_AUTO_ATTACH:-}" ]; then
|
if [ -n "${REG_AUTO_ATTACH:-}" ]; then
|
||||||
opts="$opts --auto-attach"
|
opts="$opts --auto-attach"
|
||||||
@ -30,8 +31,6 @@ else
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if [ -n "${REG_BASE_URL:-}" ]; then
|
if [ -n "${REG_BASE_URL:-}" ]; then
|
||||||
opts="$opts --baseurl=$REG_BASE_URL"
|
opts="$opts --baseurl=$REG_BASE_URL"
|
||||||
fi
|
fi
|
||||||
@ -48,12 +47,20 @@ if [ -n "${REG_SERVER_URL:-}" ]; then
|
|||||||
opts="$opts --serverurl=$REG_SERVER_URL"
|
opts="$opts --serverurl=$REG_SERVER_URL"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${REG_USER:-}" ]; then
|
if [ -n "${REG_ACTIVATION_KEY:-}" ]; then
|
||||||
opts="$opts --username $REG_USER"
|
opts="$opts --activationkey=$REG_ACTIVATION_KEY"
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "${REG_PASSWORD:-}" ]; then
|
if [ -z "${REG_ORG:-}" ]; then
|
||||||
|
echo "WARNING: REG_ACTIVATION_KEY set without REG_ORG."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [ -n "${REG_PASSWORD:-}" ]; then
|
||||||
opts="$opts --password $REG_PASSWORD"
|
opts="$opts --password $REG_PASSWORD"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "${REG_USER:-}" ]; then
|
||||||
|
opts="$opts --username $REG_USER"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${REG_MACHINE_NAME:-}" ]; then
|
if [ -n "${REG_MACHINE_NAME:-}" ]; then
|
||||||
@ -64,18 +71,18 @@ if [ -n "${REG_ORG:-}" ]; then
|
|||||||
opts="$opts --org $REG_ORG"
|
opts="$opts --org $REG_ORG"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "${REG_METHOD:-}" in
|
if [ -n "${REG_REPOS:-}" ]; then
|
||||||
portal)
|
|
||||||
if [ -n "${REG_ACTIVATION_KEY:-}" ]; then
|
|
||||||
echo "WARNING: Activation keys are not supported by the customer portal at this time."
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "${REG_REPOS:-}" ]; then
|
|
||||||
for repo in $REG_REPOS; do
|
for repo in $REG_REPOS; do
|
||||||
repos="$repos --enable $repo"
|
repos="$repos --enable $repo"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -n "${REG_TYPE:-}" ]; then
|
||||||
|
opts="$opts --type=$REG_TYPE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "${REG_METHOD:-}" in
|
||||||
|
portal)
|
||||||
subscription-manager register $opts
|
subscription-manager register $opts
|
||||||
if [ -z "${REG_AUTO_ATTACH:-}" ]; then
|
if [ -z "${REG_AUTO_ATTACH:-}" ]; then
|
||||||
subscription-manager attach $attach_opts
|
subscription-manager attach $attach_opts
|
||||||
@ -83,13 +90,7 @@ case "${REG_METHOD:-}" in
|
|||||||
subscription-manager $repos
|
subscription-manager $repos
|
||||||
;;
|
;;
|
||||||
satellite)
|
satellite)
|
||||||
repos="$repos --enable rhel-7-server-rh-common-beta-rpms"
|
repos="$repos --enable ${satellite_repo}"
|
||||||
if [ -n "${REG_REPOS:-}" ]; then
|
|
||||||
for repo in $REG_REPOS; do
|
|
||||||
repos="$repos --enable $repo"
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
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
|
||||||
subscription-manager register $opts
|
subscription-manager register $opts
|
||||||
subscription-manager $repos
|
subscription-manager $repos
|
||||||
@ -98,5 +99,5 @@ case "${REG_METHOD:-}" in
|
|||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "WARNING: only 'portal' and 'satellite' are valid values for REG_METHOD."
|
echo "WARNING: only 'portal' and 'satellite' are valid values for REG_METHOD."
|
||||||
exit 1
|
exit 1 # RHEL requires registration, fail image build if REG_Method isn't set
|
||||||
esac
|
esac
|
||||||
|
Loading…
Reference in New Issue
Block a user