[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
This commit is contained in:
Jose Luis Franco Arza 2018-10-10 17:13:56 +02:00
parent 91746c290b
commit 18987fbe32
3 changed files with 9 additions and 1 deletions

View File

@ -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: ""

View File

@ -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"

View File

@ -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