Merge "Don't trace RHEL Registration scripts"

This commit is contained in:
Jenkins 2015-04-21 14:29:02 +00:00 committed by Gerrit Code Review
commit e61ffb7fc8
2 changed files with 30 additions and 4 deletions

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# dib-lint: disable=setu sete setpipefail dibdebugtrace # dib-lint: disable=dibdebugtrace
set -eu set -eu
set -o pipefail set -o pipefail
@ -109,21 +109,34 @@ if [ -n "${REG_TYPE:-}" ]; then
opts="$opts --type=$REG_TYPE" opts="$opts --type=$REG_TYPE"
fi fi
sanitized_opts=$(echo "$opts" | sed 's/--password \([^ ]*\)/--password ***/g')
sanitized_opts=$(echo "$sanitized_opts" | sed 's/--activationkey=\([^ ]*\)/--activationkey=***/g')
case "${REG_METHOD:-}" in case "${REG_METHOD:-}" in
portal) portal)
echo "Registering with options: $sanitized_opts"
subscription-manager register $opts subscription-manager register $opts
if [ -z "${REG_AUTO_ATTACH:-}" ]; then if [ -z "${REG_AUTO_ATTACH:-}" ]; then
echo "Attaching with options: $attach_opts"
subscription-manager attach $attach_opts subscription-manager attach $attach_opts
fi fi
echo "Enabling repos: $repos"
subscription-manager $repos subscription-manager $repos
;; ;;
satellite) satellite)
# Save an unmodified copy of the repo list for logging
user_repos=$repos
repos="$repos --enable ${satellite_repo}" repos="$repos --enable ${satellite_repo}"
echo "Installing satellite dependencies"
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"
subscription-manager register $opts subscription-manager register $opts
echo "Enabling repos: $user_repos"
subscription-manager $repos subscription-manager $repos
echo "Installing katello-agent"
yum install -y katello-agent || true # needed for errata reporting to satellite6 yum install -y katello-agent || true # needed for errata reporting to satellite6
katello-package-upload katello-package-upload
echo "Disabling satellite repo because it is no longer needed"
subscription-manager repos --disable ${satellite_repo} subscription-manager repos --disable ${satellite_repo}
;; ;;
disable) disable)

View File

@ -1,8 +1,9 @@
#!/bin/bash #!/bin/bash
if [ "${DIB_DEBUG_TRACE:-1}" -gt 0 ]; then # This script deals quite a bit with passwords, which we don't ever want
set -x # included in trace output
fi # dib-lint: disable=dibdebugtrace
set -eu set -eu
set -o pipefail set -o pipefail
@ -85,19 +86,31 @@ if [ -n "${REG_TYPE:-}" ]; then
opts="$opts --type=$REG_TYPE" opts="$opts --type=$REG_TYPE"
fi fi
sanitized_opts=$(echo "$opts" | sed 's/--password \([^ ]*\)/--password ***/g')
sanitized_opts=$(echo "$sanitized_opts" | sed 's/--activationkey=\([^ ]*\)/--activationkey=***/g')
case "${REG_METHOD:-}" in case "${REG_METHOD:-}" in
portal) portal)
echo "Registering with options: $sanitized_opts"
subscription-manager register $opts subscription-manager register $opts
if [ -z "${REG_AUTO_ATTACH:-}" ]; then if [ -z "${REG_AUTO_ATTACH:-}" ]; then
echo "Attaching with options: $attach_opts"
subscription-manager attach $attach_opts subscription-manager attach $attach_opts
fi fi
echo "Enabling repos: $repos"
subscription-manager $repos subscription-manager $repos
;; ;;
satellite) satellite)
# Save an unmodified copy of the repo list for logging
user_repos=$repos
repos="$repos --enable ${satellite_repo}" repos="$repos --enable ${satellite_repo}"
echo "Installing satellite dependencies"
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"
subscription-manager register $opts subscription-manager register $opts
echo "Enabling repos: $user_repos"
subscription-manager $repos subscription-manager $repos
echo "Disabling satellite repo because it is no longer needed"
subscription-manager repos --disable ${satellite_repo} subscription-manager repos --disable ${satellite_repo}
;; ;;
disable) disable)