Merge "Add Activation Key Support For Customer Portal"

This commit is contained in:
Jenkins 2015-01-06 18:04:12 +00:00 committed by Gerrit Code Review
commit ef0c043c85
2 changed files with 51 additions and 47 deletions

View File

@ -64,12 +64,20 @@ if [ -n "${REG_SERVER_URL:-}" ]; then
opts="$opts --serverurl=$REG_SERVER_URL"
fi
if [ -n "${REG_ACTIVATION_KEY:-}" ]; then
opts="$opts --activationkey=$REG_ACTIVATION_KEY"
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"
fi
if [ -n "${REG_USER:-}" ]; then
opts="$opts --username $REG_USER"
fi
if [ -n "${REG_PASSWORD:-}" ]; then
opts="$opts --password $REG_PASSWORD"
fi
if [ -n "${REG_MACHINE_NAME:-}" ]; then
@ -79,11 +87,6 @@ fi
if [ -n "${REG_ORG:-}" ]; then
opts="$opts --org $REG_ORG"
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
for repo in $REG_REPOS; do
@ -91,6 +94,12 @@ case "${REG_METHOD:-}" in
done
fi
if [ -n "${REG_TYPE:-}" ]; then
opts="$opts --type=$REG_TYPE"
fi
case "${REG_METHOD:-}" in
portal)
subscription-manager register $opts
if [ -z "${REG_AUTO_ATTACH:-}" ]; then
subscription-manager attach $attach_opts
@ -99,12 +108,6 @@ case "${REG_METHOD:-}" in
;;
satellite)
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
subscription-manager register $opts
subscription-manager $repos
@ -115,5 +118,5 @@ case "${REG_METHOD:-}" in
;;
*)
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

View File

@ -5,6 +5,7 @@ set -o pipefail
opts=
attach_opts=
repos="repos --enable rhel-7-server-rpms"
satellite_repo="rhel-7-server-rh-common-beta-rpms"
if [ -n "${REG_AUTO_ATTACH:-}" ]; then
opts="$opts --auto-attach"
@ -30,8 +31,6 @@ else
fi
fi
if [ -n "${REG_BASE_URL:-}" ]; then
opts="$opts --baseurl=$REG_BASE_URL"
fi
@ -48,12 +47,20 @@ if [ -n "${REG_SERVER_URL:-}" ]; then
opts="$opts --serverurl=$REG_SERVER_URL"
fi
if [ -n "${REG_ACTIVATION_KEY:-}" ]; then
opts="$opts --activationkey=$REG_ACTIVATION_KEY"
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"
fi
if [ -n "${REG_USER:-}" ]; then
opts="$opts --username $REG_USER"
fi
if [ -n "${REG_PASSWORD:-}" ]; then
opts="$opts --password $REG_PASSWORD"
fi
if [ -n "${REG_MACHINE_NAME:-}" ]; then
@ -64,18 +71,18 @@ if [ -n "${REG_ORG:-}" ]; then
opts="$opts --org $REG_ORG"
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
for repo in $REG_REPOS; do
repos="$repos --enable $repo"
done
fi
if [ -n "${REG_TYPE:-}" ]; then
opts="$opts --type=$REG_TYPE"
fi
case "${REG_METHOD:-}" in
portal)
subscription-manager register $opts
if [ -z "${REG_AUTO_ATTACH:-}" ]; then
subscription-manager attach $attach_opts
@ -83,13 +90,7 @@ case "${REG_METHOD:-}" in
subscription-manager $repos
;;
satellite)
repos="$repos --enable rhel-7-server-rh-common-beta-rpms"
if [ -n "${REG_REPOS:-}" ]; then
for repo in $REG_REPOS; do
repos="$repos --enable $repo"
done
fi
repos="$repos --enable ${satellite_repo}"
rpm -Uvh "$REG_SAT_URL/pub/katello-ca-consumer-latest.noarch.rpm" || true
subscription-manager register $opts
subscription-manager $repos
@ -98,5 +99,5 @@ case "${REG_METHOD:-}" in
;;
*)
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