From 18987fbe32316e3ed8c7afcc3bf6199a10d0ee8b Mon Sep 17 00:00:00 2001 From: Jose Luis Franco Arza Date: Wed, 10 Oct 2018 17:13:56 +0200 Subject: [PATCH] [Queens/Pike] Re-registry with new rhel_reg parameters on upgrade. Currently, when the overcloud nodes were registered in Satellite or portal during deployment via extraconfig/pre_deploy/rhel-registration and an upgrade is performed passing different values for rhel_reg_repos these changes are not taken into account. As a consequence, we end up running the upgrade steps with the previous repositories configured during deployment. This patch allows us to re-register using the --force option using the new values inserted at the pre-upgrade step. To allow this, we make use of the RHELRegistrationAction parameter to change the action in which the RHELRegistrationDeployment resource is run. By setting it to UPDATE, the SoftwareDeployment resource will be triggered during the stack update which takes place in the upgrade. Passing the force option will force the re-execution of rhel-registration script even though it was executed previously during deployment (bypassing the /mnt/state/var/lib/rhsm/rhsm.ok guard. Change-Id: I51a1dad5f422756d0a8c4deff81c170be7d944d3 Related-Bug: #1797138 --- environments/lifecycle/upgrade-converge.yaml | 4 ++++ environments/lifecycle/upgrade-prepare.yaml | 4 ++++ .../pre_deploy/rhel-registration/scripts/rhel-registration | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/environments/lifecycle/upgrade-converge.yaml b/environments/lifecycle/upgrade-converge.yaml index 1e6b673208..187893fc69 100644 --- a/environments/lifecycle/upgrade-converge.yaml +++ b/environments/lifecycle/upgrade-converge.yaml @@ -11,3 +11,7 @@ parameter_defaults: UpgradeInitCommonCommand: '' UpgradeInitCommand: '' UpgradeRemoveUnusedPackages: false + # Unset RHEL registration parameters to avoid + # re-registering on future stack updates. + RHELRegistrationActions: 'CREATE' + rhel_reg_force: "" diff --git a/environments/lifecycle/upgrade-prepare.yaml b/environments/lifecycle/upgrade-prepare.yaml index 46278eafa9..8238d3e33d 100644 --- a/environments/lifecycle/upgrade-prepare.yaml +++ b/environments/lifecycle/upgrade-prepare.yaml @@ -21,3 +21,7 @@ parameter_defaults: # Remove the element os-net-config config.json https://bugs.launchpad.net/tripleo/+bug/1758161/ rm /usr/libexec/os-apply-config/templates/etc/os-net-config/config.json || true UpgradeRemoveUnusedPackages: false + # Add RHEL Registration force to re-register with the new key and repos + # also modify the actions to run the resource on stack UPDATE + RHELRegistrationActions: ['CREATE', 'UPDATE'] + rhel_reg_force: "True" diff --git a/extraconfig/pre_deploy/rhel-registration/scripts/rhel-registration b/extraconfig/pre_deploy/rhel-registration/scripts/rhel-registration index 309dfca100..8148697d7e 100644 --- a/extraconfig/pre_deploy/rhel-registration/scripts/rhel-registration +++ b/extraconfig/pre_deploy/rhel-registration/scripts/rhel-registration @@ -7,7 +7,7 @@ set -o pipefail OK=/mnt/state/var/lib/rhsm/rhsm.ok -if [ -e $OK ] ; then +if [ -e $OK -a -z "${REG_FORCE:-}" ] ; then exit 0 fi