Check if openstack-glance-registry is enabled before stopping it.

If glance-registry is defined in the service
parameters, then during upgrade, it will try
to stop it. However, as the service is not
enabled the service stop task will fail.
This patch checks if the service is enabled
before stopping it. And covers the case in
which the service might be disabled but still
running.

Closes-Bug: #1793557
Change-Id: I21d17c05f555b25f709f314f6a19a011a3d10a8d
This commit is contained in:
Jose Luis Franco Arza 2018-09-19 09:53:26 +02:00
parent fa8b4bb955
commit 6ea85bc5bb
1 changed files with 17 additions and 1 deletions

View File

@ -37,9 +37,25 @@ outputs:
value:
service_name: glance_registry_disabled
upgrade_tasks:
- when: step|int == 0
block:
- name: Check if glance_registry is deployed
command: systemctl is-enabled --quiet openstack-glance-registry
ignore_errors: True
register: glance_registry_enabled_result
- name: Check service openstack-glance-registry is running
shell: systemctl is-active --quiet openstack-glance-registry
register: glance_registry_running_result
ignore_errors: True
- name: Set facts glance_registry_enabled and glance_registry_running
set_fact:
glance_registry_enabled: "{{ glance_registry_enabled_result.rc == 0 }}"
glance_registry_running: "{{ glance_registry_running_result.rc == 0 }}"
- name: Stop and disable glance_registry service on upgrade
when: step|int == 1
service: name=openstack-glance-registry state=stopped enabled=no
when:
- step|int == 1
- glance_registry_enabled|bool or glance_registry_running|bool
fast_forward_upgrade_tasks:
- when:
- step|int == 0