From db5fb9908a808cac340a33cab19ec95cb26b0d90 Mon Sep 17 00:00:00 2001 From: Major Hayden Date: Thu, 9 Jul 2020 16:43:38 -0500 Subject: [PATCH] Do RHN registration in deploy + mockbuild Check to see if the instance is registered prior to attempting registration. Also, ensure that registration happens during mock build and during the deployment. Signed-off-by: Major Hayden --- schutzbot/deploy.sh | 6 ++++++ schutzbot/mockbuild.sh | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/schutzbot/deploy.sh b/schutzbot/deploy.sh index 9e57e1741..21cd26e5e 100755 --- a/schutzbot/deploy.sh +++ b/schutzbot/deploy.sh @@ -21,6 +21,12 @@ function retry { # Get OS details. source /etc/os-release +# Register RHEL if we are provided with a registration script. +if [[ -n "${RHN_REGISTRATION_SCRIPT:-}" ]] && ! sudo subscription-manager status; then + sudo chmod +x $RHN_REGISTRATION_SCRIPT + sudo $RHN_REGISTRATION_SCRIPT +fi + # Restart systemd to work around some Fedora issues in cloud images. sudo systemctl restart systemd-journald diff --git a/schutzbot/mockbuild.sh b/schutzbot/mockbuild.sh index 8faca2587..cc367bd8a 100755 --- a/schutzbot/mockbuild.sh +++ b/schutzbot/mockbuild.sh @@ -19,7 +19,7 @@ if [[ $ID == rhel ]] && ! rpm -q epel-release; then fi # Register RHEL if we are provided with a registration script. -if [[ -n "${RHN_REGISTRATION_SCRIPT:-}" ]]; then +if [[ -n "${RHN_REGISTRATION_SCRIPT:-}" ]] && ! sudo subscription-manager status; then greenprint "🪙 Registering RHEL instance" sudo chmod +x $RHN_REGISTRATION_SCRIPT sudo $RHN_REGISTRATION_SCRIPT