diff --git a/elements/rhel-common/os-refresh-config/pre-configure.d/06-rhel-registration b/elements/rhel-common/os-refresh-config/pre-configure.d/06-rhel-registration index 2211a28cd..79144eef6 100755 --- a/elements/rhel-common/os-refresh-config/pre-configure.d/06-rhel-registration +++ b/elements/rhel-common/os-refresh-config/pre-configure.d/06-rhel-registration @@ -1,6 +1,6 @@ #!/bin/bash -# dib-lint: disable=setu sete setpipefail dibdebugtrace +# dib-lint: disable=dibdebugtrace set -eu set -o pipefail @@ -109,21 +109,34 @@ if [ -n "${REG_TYPE:-}" ]; then opts="$opts --type=$REG_TYPE" fi +sanitized_opts=$(echo "$opts" | sed 's/--password \([^ ]*\)/--password ***/g') +sanitized_opts=$(echo "$sanitized_opts" | sed 's/--activationkey=\([^ ]*\)/--activationkey=***/g') + case "${REG_METHOD:-}" in portal) + echo "Registering with options: $sanitized_opts" subscription-manager register $opts if [ -z "${REG_AUTO_ATTACH:-}" ]; then + echo "Attaching with options: $attach_opts" subscription-manager attach $attach_opts fi + echo "Enabling repos: $repos" subscription-manager $repos ;; satellite) + # Save an unmodified copy of the repo list for logging + user_repos=$repos repos="$repos --enable ${satellite_repo}" + echo "Installing satellite dependencies" rpm -Uvh "$REG_SAT_URL/pub/katello-ca-consumer-latest.noarch.rpm" || true + echo "Registering with options: $sanitized_opts" subscription-manager register $opts + echo "Enabling repos: $user_repos" subscription-manager $repos + echo "Installing katello-agent" yum install -y katello-agent || true # needed for errata reporting to satellite6 katello-package-upload + echo "Disabling satellite repo because it is no longer needed" subscription-manager repos --disable ${satellite_repo} ;; disable) diff --git a/elements/rhel-common/pre-install.d/00-rhel-registration b/elements/rhel-common/pre-install.d/00-rhel-registration index a5ed2d513..305c3edf0 100755 --- a/elements/rhel-common/pre-install.d/00-rhel-registration +++ b/elements/rhel-common/pre-install.d/00-rhel-registration @@ -1,8 +1,9 @@ #!/bin/bash -if [ "${DIB_DEBUG_TRACE:-1}" -gt 0 ]; then - set -x -fi +# This script deals quite a bit with passwords, which we don't ever want +# included in trace output +# dib-lint: disable=dibdebugtrace + set -eu set -o pipefail @@ -85,19 +86,31 @@ if [ -n "${REG_TYPE:-}" ]; then opts="$opts --type=$REG_TYPE" fi +sanitized_opts=$(echo "$opts" | sed 's/--password \([^ ]*\)/--password ***/g') +sanitized_opts=$(echo "$sanitized_opts" | sed 's/--activationkey=\([^ ]*\)/--activationkey=***/g') + case "${REG_METHOD:-}" in portal) + echo "Registering with options: $sanitized_opts" subscription-manager register $opts if [ -z "${REG_AUTO_ATTACH:-}" ]; then + echo "Attaching with options: $attach_opts" subscription-manager attach $attach_opts fi + echo "Enabling repos: $repos" subscription-manager $repos ;; satellite) + # Save an unmodified copy of the repo list for logging + user_repos=$repos repos="$repos --enable ${satellite_repo}" + echo "Installing satellite dependencies" rpm -Uvh "$REG_SAT_URL/pub/katello-ca-consumer-latest.noarch.rpm" || true + echo "Registering with options: $sanitized_opts" subscription-manager register $opts + echo "Enabling repos: $user_repos" subscription-manager $repos + echo "Disabling satellite repo because it is no longer needed" subscription-manager repos --disable ${satellite_repo} ;; disable)