tripleo-heat-templates/puppet/services/disabled/glance-registry-disabled.yaml
Jose Luis Franco Arza 6ea85bc5bb 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
2018-09-26 08:45:56 +02:00

77 lines
2.8 KiB
YAML

heat_template_version: rocky
description: >
OpenStack Glance Registry service, disabled since ocata
parameters:
ServiceData:
default: {}
description: Dictionary packing service data
type: json
ServiceNetMap:
default: {}
description: Mapping of service_name -> network name. Typically set
via parameter_defaults in the resource registry. This
mapping overrides those in ServiceNetMapDefaults.
type: json
DefaultPasswords:
default: {}
type: json
RoleName:
default: ''
description: Role name on which the service is applied
type: string
RoleParameters:
default: {}
description: Parameters specific to the role
type: json
EndpointMap:
default: {}
description: Mapping of service endpoint -> protocol. Typically set
via parameter_defaults in the resource registry.
type: json
outputs:
role_data:
description: Role data for the disabled Glance Registry role.
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
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
- release == 'ocata'
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: Set fact glance_registry_enabled
set_fact:
glance_registry_enabled: "{{ glance_registry_enabled_result.rc == 0 }}"
- name: Stop openstack-glance-registry
service: name=openstack-glance-registry state=stopped enabled=no
when:
- step|int == 1
- release == 'ocata'
- glance_registry_enabled|bool