[Queens only] Include new parameter RHELRegistrationUpgrade to rhel-registration.

Setting the rhel_reg_force parameter to true during upgrade prepare
doesn't work correctly when the customer passes the rhel-registration/
environment-rhel-registration.yaml, as this template sets an empty
value for that parameter by default (an which is usually not modified
by the user). As environments/lifecycle/upgrade-prepare.yaml is prepended,
any template setting a different value for rhel_reg_force param will have
precedence on what we set in the upgade-prepare.yaml env file.

The solution is creating a new parameter RHELRegistrationUpgrade, which
defaults to false and which we ensure it's set to true during upgrade
prepare by setting it in environments/lifecycle/upgrade-prepare.yaml.
When RHELRegistrationUpgrade is set to True we enforce that REG_FORCE
sets to True, otherwise it will simply take the value passed in the heat
parameter rhel_reg_force.

Closes-Bug: #1813184

Change-Id: Idc1bdad0a19150569dacb88abd539d86741bc643
This commit is contained in:
Jose Luis Franco Arza 2019-01-24 15:31:30 +01:00
parent 59f81bad9f
commit 2e38cba405
3 changed files with 11 additions and 3 deletions

View File

@ -14,4 +14,4 @@ parameter_defaults:
# Unset RHEL registration parameters to avoid # Unset RHEL registration parameters to avoid
# re-registering on future stack updates. # re-registering on future stack updates.
RHELRegistrationActions: 'CREATE' RHELRegistrationActions: 'CREATE'
rhel_reg_force: "" RHELRegistrationUpgrade: true

View File

@ -24,4 +24,4 @@ parameter_defaults:
# Add RHEL Registration force to re-register with the new key and repos # Add RHEL Registration force to re-register with the new key and repos
# also modify the actions to run the resource on stack UPDATE # also modify the actions to run the resource on stack UPDATE
RHELRegistrationActions: ['CREATE', 'UPDATE'] RHELRegistrationActions: ['CREATE', 'UPDATE']
rhel_reg_force: "True" RHELRegistrationUpgrade: true

View File

@ -70,6 +70,10 @@ parameters:
default: default:
- CREATE - CREATE
description: Actions when the system profile will be registered, by default we only do this on CREATE of a new server, not for existing nodes. description: Actions when the system profile will be registered, by default we only do this on CREATE of a new server, not for existing nodes.
RHELRegistrationUpgrade:
type: boolean
default: false
description: Forces the registration when performing an upgrade.
conditions: conditions:
unregister_on_delete: unregister_on_delete:
@ -80,6 +84,10 @@ conditions:
equals: equals:
- {get_param: UpdateOnRHELRegistration} - {get_param: UpdateOnRHELRegistration}
- true - true
upgrading:
equals:
- { get_param: RHELRegistrationUpgrade }
- true
resources: resources:
@ -124,7 +132,7 @@ resources:
REG_AUTO_ATTACH: {get_param: rhel_reg_auto_attach} REG_AUTO_ATTACH: {get_param: rhel_reg_auto_attach}
REG_BASE_URL: {get_param: rhel_reg_base_url} REG_BASE_URL: {get_param: rhel_reg_base_url}
REG_ENVIRONMENT: {get_param: rhel_reg_environment} REG_ENVIRONMENT: {get_param: rhel_reg_environment}
REG_FORCE: {get_param: rhel_reg_force} REG_FORCE: {if: [upgrading, "True", {get_param: rhel_reg_force}]}
REG_MACHINE_NAME: {get_param: rhel_reg_machine_name} REG_MACHINE_NAME: {get_param: rhel_reg_machine_name}
REG_ORG: {get_param: rhel_reg_org} REG_ORG: {get_param: rhel_reg_org}
REG_PASSWORD: {get_param: rhel_reg_password} REG_PASSWORD: {get_param: rhel_reg_password}