Merge "Add validation task in docker services [Heat]"

This commit is contained in:
Zuul 2017-12-23 07:20:36 +00:00 committed by Gerrit Code Review
commit 843f6dc4ca
3 changed files with 61 additions and 29 deletions

View File

@ -131,24 +131,35 @@ outputs:
host_prep_tasks: {get_attr: [HeatApiCfnLogging, host_prep_tasks]} host_prep_tasks: {get_attr: [HeatApiCfnLogging, host_prep_tasks]}
upgrade_tasks: upgrade_tasks:
- name: Check if heat_api_cfn is deployed - name: Check if heat_api_cfn is deployed
command: systemctl is-enabled openstack-heat-api-cfn command: systemctl is-enabled --quiet openstack-heat-api-cfn
tags: common tags: common
ignore_errors: True ignore_errors: True
register: heat_api_cfn_enabled register: heat_api_cfn_enabled
- name: check for heat_api_cfn running under apache (post upgrade) - name: Check for heat_api_cfn running under apache
tags: step2 tags: common
shell: "httpd -t -D DUMP_VHOSTS | grep -q heat_api_cfn_wsgi" shell: "httpd -t -D DUMP_VHOSTS | grep -q heat_api_cfn_wsgi"
register: heat_api_cfn_apache ignore_errors: True
ignore_errors: true register: httpd_enabled
changed_when: false - name: "PreUpgrade step0,validation: Check service openstack-heat-api-cfn is running"
check_mode: no command: systemctl is-active --quiet openstack-heat-api-cfn
- name: Stop heat_api_cfn service (running under httpd) when: heat_api_cfn_enabled.rc == 0 and httpd_enabled.rc != 0
tags: step2 tags: step0,validation
service: name=httpd state=stopped
when: heat_api_cfn_apache.rc == 0
- name: Stop and disable heat_api_cfn service (pre-upgrade not under httpd) - name: Stop and disable heat_api_cfn service (pre-upgrade not under httpd)
tags: step2 tags: step2
service: name=openstack-heat-api-cfn state=stopped enabled=no service: name=openstack-heat-api-cfn state=stopped enabled=no
when: heat_api_cfn_enabled.rc == 0 when: heat_api_cfn_enabled.rc == 0 and httpd_enabled.rc != 0
- name: Check if httpd service is running
command: systemctl is-active --quiet httpd
tags: common
ignore_errors: True
register: httpd_running
- name: "PreUpgrade step0,validation: Check if heat_api_cfn_wsgi is running"
tags: step0,validation
shell: systemctl status 'httpd' | grep -q heat_api_cfn_wsgi
when: httpd_enabled.rc == 0 and httpd_running.rc == 0
- name: Stop heat_api_cfn service (running under httpd)
tags: step2
service: name=httpd state=stopped
when: httpd_enabled.rc == 0 and httpd_running.rc == 0
metadata_settings: metadata_settings:
get_attr: [HeatBase, role_data, metadata_settings] get_attr: [HeatBase, role_data, metadata_settings]

View File

@ -156,30 +156,41 @@ outputs:
- KOLLA_CONFIG_STRATEGY=COPY_ALWAYS - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
host_prep_tasks: {get_attr: [HeatApiLogging, host_prep_tasks]} host_prep_tasks: {get_attr: [HeatApiLogging, host_prep_tasks]}
upgrade_tasks: upgrade_tasks:
- name: Check is heat_api is deployed - name: Check if heat_api is deployed
command: systemctl is-enabled openstack-heat-api command: systemctl is-enabled --quiet openstack-heat-api
tags: common tags: common
ignore_errors: True ignore_errors: True
register: heat_api_enabled register: heat_api_enabled
- name: Check for heat_api running under apache
tags: common
shell: "httpd -t -D DUMP_VHOSTS | grep -q heat_api_wsgi"
ignore_errors: True
register: httpd_enabled
- name: "PreUpgrade step0,validation: Check service openstack-heat-api is running"
command: systemctl is-active --quiet openstack-heat-api
when: heat_api_enabled.rc == 0 and httpd_enabled.rc != 0
tags: step0,validation
- name: Stop and disable heat_api service (pre-upgrade not under httpd)
tags: step2
service: name=openstack-heat-api state=stopped enabled=no
when: heat_api_enabled.rc == 0 and httpd_enabled.rc != 0
- name: Check if httpd is running
tags: common
command: systemctl is-active --quiet httpd
ignore_errors: True
register: httpd_running
- name: "PreUpgrade step0,validation: Check if heat_api_wsgi is running"
shell: systemctl status 'httpd' | grep -q heat_api_wsgi
tags: step0,validation
when: httpd_enabled.rc == 0 and httpd_running.rc == 0
- name: Stop heat_api service (running under httpd)
tags: step2
service: name=httpd state=stopped
when: httpd_enabled.rc == 0 and httpd_running.rc == 0
- name: remove old heat cron jobs - name: remove old heat cron jobs
tags: step2 tags: step2
file: file:
path: /var/spool/cron/heat path: /var/spool/cron/heat
state: absent state: absent
- name: check for heat_api running under apache (post upgrade)
tags: step2
shell: "httpd -t -D DUMP_VHOSTS | grep -q heat_api_wsgi"
register: heat_api_apache
ignore_errors: true
changed_when: false
check_mode: no
- name: Stop heat_api service (running under httpd)
tags: step2
service: name=httpd state=stopped
when: heat_api_apache.rc == 0
- name: Stop and disable heat_api service (pre-upgrade not under httpd)
tags: step2
service: name=openstack-heat-api state=stopped enabled=no
when: heat_api_enabled.rc == 0
metadata_settings: metadata_settings:
get_attr: [HeatBase, role_data, metadata_settings] get_attr: [HeatBase, role_data, metadata_settings]

View File

@ -134,6 +134,16 @@ outputs:
- KOLLA_CONFIG_STRATEGY=COPY_ALWAYS - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
host_prep_tasks: {get_attr: [HeatEngineLogging, host_prep_tasks]} host_prep_tasks: {get_attr: [HeatEngineLogging, host_prep_tasks]}
upgrade_tasks: upgrade_tasks:
- name: Check if heat_engine is deployed
command: systemctl is-enabled --quiet openstack-heat-engine
tags: common
ignore_errors: True
register: heat_engine_enabled
- name: "PreUpgrade step0,validation: Check service openstack-heat-engine is running"
command: systemctl is-active --quiet openstack-heat-engine
when: heat_engine_enabled.rc == 0
tags: step0,validation
- name: Stop and disable heat_engine service - name: Stop and disable heat_engine service
tags: step2 tags: step2
when: heat_engine_enabled.rc == 0
service: name=openstack-heat-engine state=stopped enabled=no service: name=openstack-heat-engine state=stopped enabled=no