Browse code

Make ./clean.sh work in more situations

When transitioning between different wsgi modes, or service modes, we
should really safely stop and cleanup things that are started in any
service mode, which makes it easier to ensure that we don't leave
things around from past runs.

Change-Id: I33acbee39e1a2da2bfd79a5dd54b84a12a778be1

Sean Dague authored on 2017/05/01 23:52:38
Showing 3 changed files
... ...
@@ -1679,15 +1679,12 @@ function stop_process {
1679 1679
     SERVICE_DIR=${SERVICE_DIR:-${DEST}/status}
1680 1680
 
1681 1681
     if is_service_enabled $service; then
1682
-        # Kill via pid if we have one available
1683
-        if [[ "$USE_SYSTEMD" == "True" ]]; then
1684
-            # Only do this for units which appear enabled, this also
1685
-            # catches units that don't really exist for cases like
1686
-            # keystone without a failure.
1687
-            if $SYSTEMCTL is-enabled devstack@$service.service; then
1688
-                $SYSTEMCTL stop devstack@$service.service
1689
-                $SYSTEMCTL disable devstack@$service.service
1690
-            fi
1682
+        # Only do this for units which appear enabled, this also
1683
+        # catches units that don't really exist for cases like
1684
+        # keystone without a failure.
1685
+        if $SYSTEMCTL is-enabled devstack@$service.service; then
1686
+            $SYSTEMCTL stop devstack@$service.service
1687
+            $SYSTEMCTL disable devstack@$service.service
1691 1688
         fi
1692 1689
 
1693 1690
         if [[ -r $SERVICE_DIR/$SCREEN_NAME/$service.pid ]]; then
... ...
@@ -141,16 +141,16 @@ function is_keystone_enabled {
141 141
 # cleanup_keystone() - Remove residual data files, anything left over from previous
142 142
 # runs that a clean run would need to clean up
143 143
 function cleanup_keystone {
144
-    if [[ "$WSGI_MODE" == "uwsgi" ]]; then
145
-        # TODO: remove admin at pike-2
146
-        remove_uwsgi_config "$KEYSTONE_PUBLIC_UWSGI_CONF" "$KEYSTONE_PUBLIC_UWSGI"
147
-        remove_uwsgi_config "$KEYSTONE_ADMIN_UWSGI_CONF" "$KEYSTONE_ADMIN_UWSGI"
148
-        sudo rm -f $(apache_site_config_for keystone-wsgi-public)
149
-        sudo rm -f $(apache_site_config_for keystone-wsgi-admin)
150
-    else
151
-        disable_apache_site keystone
152
-        sudo rm -f $(apache_site_config_for keystone)
153
-    fi
144
+    # TODO: remove admin at pike-2
145
+    # These files will be created if we are running WSGI_MODE="uwsgi"
146
+    remove_uwsgi_config "$KEYSTONE_PUBLIC_UWSGI_CONF" "$KEYSTONE_PUBLIC_UWSGI"
147
+    remove_uwsgi_config "$KEYSTONE_ADMIN_UWSGI_CONF" "$KEYSTONE_ADMIN_UWSGI"
148
+    sudo rm -f $(apache_site_config_for keystone-wsgi-public)
149
+    sudo rm -f $(apache_site_config_for keystone-wsgi-admin)
150
+
151
+    # These files will be created if we are running WSGI_MODE="mod_wsgi"
152
+    disable_apache_site keystone
153
+    sudo rm -f $(apache_site_config_for keystone)
154 154
 }
155 155
 
156 156
 # _config_keystone_apache_wsgi() - Set WSGI config files of Keystone
... ...
@@ -69,6 +69,7 @@ function is_placement_enabled {
69 69
 # cleanup_placement() - Remove residual data files, anything left over from previous
70 70
 # runs that a clean run would need to clean up
71 71
 function cleanup_placement {
72
+    sudo rm -f $(apache_site_config_for nova-placement-api)
72 73
     sudo rm -f $(apache_site_config_for placement-api)
73 74
 }
74 75