Move UpgradeInitCommand and UpgradeInitCommonCommand to run by Ansible

This change moves the execution of UpgradeInitCommand
and UpgradeInitCommonCommand to be executed with
Ansible in the upgrade step 0 instead of Heat.

Closes-bug: 1812659
Change-Id: I76eb6a2572e24b6f114e38897a68cd85276af3c6
(cherry picked from commit 9164e6adbd)
This commit is contained in:
Carlos Camacho 2019-01-21 16:05:58 +01:00
parent 3322a5b892
commit 5753352ee7
3 changed files with 36 additions and 57 deletions

View File

@ -69,26 +69,6 @@ resources:
software_config_transport: {get_param: software_config_transport}
deployment_swift_data: {get_param: deployment_swift_data}
UpgradeInitConfig:
type: OS::Heat::SoftwareConfig
properties:
group: script
config:
list_join:
- ''
- - "#!/bin/bash\n\n"
- "if [[ -f /etc/resolv.conf.save ]] ; then rm /etc/resolv.conf.save; fi\n\n"
- get_param: UpgradeInitCommand
- get_param: UpgradeInitCommonCommand
UpgradeInitDeployment:
type: OS::Heat::SoftwareDeployment
properties:
name: UpgradeInitDeployment
server: {get_resource: deployed-server}
config: {get_resource: UpgradeInitConfig}
InstanceIdConfig:
type: OS::Heat::StructuredConfig
properties:
@ -102,7 +82,6 @@ resources:
name: InstanceIdDeployment
config: {get_resource: InstanceIdConfig}
server: {get_resource: deployed-server}
depends_on: UpgradeInitDeployment
HostsEntryConfig:
type: OS::Heat::SoftwareConfig

View File

@ -615,36 +615,8 @@ resources:
- {get_param: NetworkDeploymentActions}
- []
{{server_resource_name}}UpgradeInitConfig:
type: OS::Heat::SoftwareConfig
properties:
group: script
config:
list_join:
- ''
- - "#!/bin/bash\n\n"
- "if [[ -f /etc/resolv.conf.save ]] ; then rm /etc/resolv.conf.save; fi\n\n"
- get_param: UpgradeInitCommand
- get_param: UpgradeInitCommonCommand
# Note we may be able to make this conditional on UpgradeInitCommandNotEmpty
# but https://bugs.launchpad.net/heat/+bug/1649900 needs fixing first
{{server_resource_name}}UpgradeInitDeployment:
type: OS::Heat::SoftwareDeployment
depends_on: NetworkDeployment
properties:
name: {{server_resource_name}}UpgradeInitDeployment
server: {get_resource: {{server_resource_name}}}
config: {get_resource: {{server_resource_name}}UpgradeInitConfig}
actions:
if:
- server_not_blacklisted
- ['CREATE', 'UPDATE']
- []
{{server_resource_name}}Deployment:
type: OS::Heat::StructuredDeployment
depends_on: {{server_resource_name}}UpgradeInitDeployment
properties:
name: {{server_resource_name}}Deployment
config: {get_resource: {{server_resource_name}}Config}

View File

@ -51,6 +51,20 @@ parameters:
echo "and passed the upstream name (ocata, pike, queens) of the release as first argument"
exit 1
type: string
UpgradeInitCommand:
type: string
description: |
Command or script snippet to run on all overcloud nodes to
initialize the upgrade process. E.g. a repository switch.
default: ''
UpgradeInitCommonCommand:
type: string
description: |
Common commands required by the upgrades process. This should not
normally be modified by the operator and is set and unset in the
major-upgrade-composable-steps.yaml and major-upgrade-converge.yaml
environment files.
default: ''
outputs:
role_data:
@ -62,15 +76,29 @@ outputs:
step_config: |
include ::tripleo::packages
upgrade_tasks:
- name: Check yum for rpm-python present
- name: Package and repo update tasks
when: step|int == 0
package: "name=rpm-python state=present"
register: rpm_python_check
- name: Fail when rpm-python wasn't present
fail: msg="rpm-python package was not present before this run! Check environment before re-running"
when:
- step|int == 0
- rpm_python_check.changed != false
block:
- name: Run UpgradeInitCommand
shell:
list_join:
- ''
- - "#!/bin/bash\n\n"
- "if [[ -f /etc/resolv.conf.save ]] ; then rm /etc/resolv.conf.save; fi\n\n"
- {get_param: UpgradeInitCommand}
- name: Run UpgradeInitCommonCommand
shell:
list_join:
- ''
- - "#!/bin/bash\n\n"
- {get_param: UpgradeInitCommonCommand}
- name: Check yum for rpm-python present
package: "name=rpm-python state=present"
register: rpm_python_check
- name: Fail when rpm-python wasn't present
fail: msg="rpm-python package was not present before this run! Check environment before re-running"
when:
- rpm_python_check.changed != false
# With the layered product packaging, the key package is rhosp-openvswitch. It depends on
# a openvswitch package that includes the version as part of the name (e.g openvswitch2.10).
# This requires some additional special handling: