Browse Source

[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
changes/26/633026/2
Jose Luis Franco Arza 3 years ago
parent
commit
2e38cba405
  1. 2
      environments/lifecycle/upgrade-converge.yaml
  2. 2
      environments/lifecycle/upgrade-prepare.yaml
  3. 10
      extraconfig/pre_deploy/rhel-registration/rhel-registration.yaml

2
environments/lifecycle/upgrade-converge.yaml

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

2
environments/lifecycle/upgrade-prepare.yaml

@ -24,4 +24,4 @@ parameter_defaults:
# 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"
RHELRegistrationUpgrade: true

10
extraconfig/pre_deploy/rhel-registration/rhel-registration.yaml

@ -70,6 +70,10 @@ parameters:
default:
- 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.
RHELRegistrationUpgrade:
type: boolean
default: false
description: Forces the registration when performing an upgrade.
conditions:
unregister_on_delete:
@ -80,6 +84,10 @@ conditions:
equals:
- {get_param: UpdateOnRHELRegistration}
- true
upgrading:
equals:
- { get_param: RHELRegistrationUpgrade }
- true
resources:
@ -124,7 +132,7 @@ resources:
REG_AUTO_ATTACH: {get_param: rhel_reg_auto_attach}
REG_BASE_URL: {get_param: rhel_reg_base_url}
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_ORG: {get_param: rhel_reg_org}
REG_PASSWORD: {get_param: rhel_reg_password}

Loading…
Cancel
Save