Browse code

Split keystone mod wsgi config from start/stop

We currently cleanup keystone apache config during stop_keystone
when mod wsgi is enabled, but only create it during initial keystone
configuration. Grenade expects to be able to stop and start the
service without reconfiguring it, using only the respective functions.
This moves cleanup of config from stop_keystone to cleanup_keystone,
and enables/disables the apache vhost during start/stop.

Closes-bug: #1365105

Change-Id: I9e57c9a763fbdb8c5737decfe797ba0e9894150b

Adam Gandelman authored on 2014/09/04 03:44:31
Showing 1 changed files
... ...
@@ -6,6 +6,7 @@
6 6
 # - ``functions`` file
7 7
 # - ``tls`` file
8 8
 # - ``DEST``, ``STACK_USER``
9
+# - ``FILES``
9 10
 # - ``IDENTITY_API_VERSION``
10 11
 # - ``BASE_SQL_CONN``
11 12
 # - ``SERVICE_HOST``, ``SERVICE_PROTOCOL``
... ...
@@ -104,18 +105,13 @@ KEYSTONE_SERVICE_URI=${KEYSTONE_SERVICE_PROTOCOL}://${KEYSTONE_SERVICE_HOST}:${K
104 104
 # cleanup_keystone() - Remove residual data files, anything left over from previous
105 105
 # runs that a clean run would need to clean up
106 106
 function cleanup_keystone {
107
-    # kill instances (nova)
108
-    # delete image files (glance)
109
-    # This function intentionally left blank
110
-    :
107
+    _cleanup_keystone_apache_wsgi
111 108
 }
112 109
 
113 110
 # _cleanup_keystone_apache_wsgi() - Remove wsgi files, disable and remove apache vhost file
114 111
 function _cleanup_keystone_apache_wsgi {
115 112
     sudo rm -f $KEYSTONE_WSGI_DIR/*.wsgi
116
-    disable_apache_site keystone
117 113
     sudo rm -f $(apache_site_config_for keystone)
118
-    restart_apache_server
119 114
 }
120 115
 
121 116
 # _config_keystone_apache_wsgi() - Set WSGI config files of Keystone
... ...
@@ -145,7 +141,6 @@ function _config_keystone_apache_wsgi {
145 145
         s|%USER%|$STACK_USER|g
146 146
         s|%ERRORLOGFORMAT%|$errorlogformat|g;
147 147
     " -i $keystone_apache_conf
148
-    enable_apache_site keystone
149 148
 }
150 149
 
151 150
 # configure_keystone() - Set config files, create data dirs, etc
... ...
@@ -473,6 +468,7 @@ function start_keystone {
473 473
     fi
474 474
 
475 475
     if [ "$KEYSTONE_USE_MOD_WSGI" == "True" ]; then
476
+        enable_apache_site keystone
476 477
         restart_apache_server
477 478
         tail_log key /var/log/$APACHE_NAME/keystone.log
478 479
         tail_log key-access /var/log/$APACHE_NAME/keystone_access.log
... ...
@@ -498,10 +494,12 @@ function start_keystone {
498 498
 
499 499
 # stop_keystone() - Stop running processes
500 500
 function stop_keystone {
501
+    if [ "$KEYSTONE_USE_MOD_WSGI" == "True" ]; then
502
+        disable_apache_site keystone
503
+        restart_apache_server
504
+    fi
501 505
     # Kill the Keystone screen window
502 506
     stop_process key
503
-    # Cleanup the WSGI files and VHOST
504
-    _cleanup_keystone_apache_wsgi
505 507
 }
506 508
 
507 509
 function is_keystone_enabled {