aboutsummaryrefslogtreecommitdiffstats
path: root/extraconfig/pre_deploy/rhel-registration
diff options
context:
space:
mode:
authorJames Slagle <jslagle@redhat.com>2016-03-22 17:26:42 -0400
committerJames Slagle <jslagle@redhat.com>2016-03-23 10:20:16 -0400
commit51170114683e6d986b32aced253e5ebcf47fdedc (patch)
tree533f5767c713cbae995db5cd07c6916190f3d83e /extraconfig/pre_deploy/rhel-registration
parent7ac441f019214e465a8e26fe03074b9ebd479034 (diff)
Fix satellite registration for http or https
If the satellite registration url was specified with https, the curl command to detect the satellite version would not work as expected since -L was not passed and you get redirected to https when testing the ping api. To additionally handle the case where https is specified, also use curl directly with -k to download the configuration rpm instead of using rpm with a url. Fixes another bug with a missing $ in the reference to the $satellite_version variable. Change-Id: I984fdfc415eeeed4ef29cc8d0812e1b67545d6b1
Diffstat (limited to 'extraconfig/pre_deploy/rhel-registration')
-rw-r--r--extraconfig/pre_deploy/rhel-registration/scripts/rhel-registration9
1 files changed, 5 insertions, 4 deletions
diff --git a/extraconfig/pre_deploy/rhel-registration/scripts/rhel-registration b/extraconfig/pre_deploy/rhel-registration/scripts/rhel-registration
index 76fa63b4..242819b0 100644
--- a/extraconfig/pre_deploy/rhel-registration/scripts/rhel-registration
+++ b/extraconfig/pre_deploy/rhel-registration/scripts/rhel-registration
@@ -98,10 +98,10 @@ fi
function detect_satellite_version {
ping_api=$REG_SAT_URL/katello/api/ping
- if curl -k -s -D - -o /dev/null $ping_api | grep "200 OK"; then
+ if curl -L -k -s -D - -o /dev/null $ping_api | grep "200 OK"; then
echo Satellite 6 detected at $REG_SAT_URL
satellite_version=6
- elif curl -k -s -D - -o /dev/null $REG_SAT_URL/rhn/Login.do | grep "200 OK"; then
+ elif curl -L -k -s -D - -o /dev/null $REG_SAT_URL/rhn/Login.do | grep "200 OK"; then
echo Satellite 5 detected at $REG_SAT_URL
satellite_version=5
else
@@ -120,9 +120,10 @@ case "${REG_METHOD:-}" in
;;
satellite)
detect_satellite_version
- if [ "satellite_version" = "6" ]; then
+ if [ "$satellite_version" = "6" ]; then
repos="$repos --enable ${satellite_repo}"
- rpm -Uvh "$REG_SAT_URL/pub/katello-ca-consumer-latest.noarch.rpm" || true
+ curl -L -k -O "$REG_SAT_URL/pub/katello-ca-consumer-latest.noarch.rpm"
+ rpm -Uvh katello-ca-consumer-latest.noarch.rpm || true
subscription-manager register $opts
subscription-manager $repos
yum install -y katello-agent || true # needed for errata reporting to satellite6