Stop Heat WSGI services on docker upgrade
authorThomas Herve <therve@redhat.com>
Wed, 12 Jul 2017 14:54:23 +0000 (16:54 +0200)
committerEmilien Macchi <emilien@redhat.com>
Wed, 19 Jul 2017 13:21:30 +0000 (06:21 -0700)
As we made the migration to HTTPd during the same cycle, we didn't
include stopping the WSGI services before the upgrades. This handles the
case, and fixes an issue with the puppet upgrade as well.

Change-Id: I54ba6214d4bf052c0d840d5bbce2b524d82b7017
Closes-Bug: #1699443

docker/services/heat-api-cfn.yaml
docker/services/heat-api.yaml
puppet/services/heat-api-cfn.yaml

index aff0f1a..7061289 100644 (file)
@@ -125,8 +125,25 @@ outputs:
             path: /var/log/containers/heat
             state: directory
       upgrade_tasks:
-        - name: Stop and disable heat_api_cfn service
+        - name: Check if heat_api_cfn is deployed
+          command: systemctl is-enabled openstack-heat-api-cfn
+          tags: common
+          ignore_errors: True
+          register: heat_api_cfn_enabled
+        - name: check for heat_api_cfn running under apache (post upgrade)
           tags: step2
-          service: name=httpd state=stopped enabled=no
+          shell: "httpd -t -D DUMP_VHOSTS | grep -q heat_api_cfn_wsgi"
+          register: heat_api_cfn_apache
+          ignore_errors: true
+          changed_when: false
+          check_mode: no
+        - name: Stop heat_api_cfn service (running under httpd)
+          tags: step2
+          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)
+          tags: step2
+          service: name=openstack-heat-api-cfn state=stopped enabled=no
+          when: heat_api_cfn_enabled.rc == 0
       metadata_settings:
         get_attr: [HeatBase, role_data, metadata_settings]
index d09230f..c7e863f 100644 (file)
@@ -125,8 +125,25 @@ outputs:
             path: /var/log/containers/heat
             state: directory
       upgrade_tasks:
-        - name: Stop and disable heat_api service
+        - name: Check is heat_api is deployed
+          command: systemctl is-enabled openstack-heat-api
+          tags: common
+          ignore_errors: True
+          register: heat_api_enabled
+        - name: check for heat_api running under apache (post upgrade)
           tags: step2
-          service: name=httpd state=stopped enabled=no
+          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:
         get_attr: [HeatBase, role_data, metadata_settings]
index 2c13cb3..be63d6f 100644 (file)
@@ -151,5 +151,5 @@ outputs:
           when: heat_api_cfn_apache.rc == 0
         - name: Stop and disable heat_api_cfn service (pre-upgrade not under httpd)
           tags: step1
-          when: heat_api_cfn_apache.rc == 0
+          when: heat_api_cfn_enabled.rc == 0
           service: name=openstack-heat-api-cfn state=stopped enabled=no