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
This commit is contained in:
Sean Dague 2017-05-01 10:52:38 -04:00
parent 7fe9e784c6
commit 803acffcf9
3 changed files with 17 additions and 19 deletions

View File

@ -1679,15 +1679,12 @@ function stop_process {
SERVICE_DIR=${SERVICE_DIR:-${DEST}/status} SERVICE_DIR=${SERVICE_DIR:-${DEST}/status}
if is_service_enabled $service; then if is_service_enabled $service; then
# Kill via pid if we have one available # Only do this for units which appear enabled, this also
if [[ "$USE_SYSTEMD" == "True" ]]; then # catches units that don't really exist for cases like
# Only do this for units which appear enabled, this also # keystone without a failure.
# catches units that don't really exist for cases like if $SYSTEMCTL is-enabled devstack@$service.service; then
# keystone without a failure. $SYSTEMCTL stop devstack@$service.service
if $SYSTEMCTL is-enabled devstack@$service.service; then $SYSTEMCTL disable devstack@$service.service
$SYSTEMCTL stop devstack@$service.service
$SYSTEMCTL disable devstack@$service.service
fi
fi fi
if [[ -r $SERVICE_DIR/$SCREEN_NAME/$service.pid ]]; then if [[ -r $SERVICE_DIR/$SCREEN_NAME/$service.pid ]]; then

View File

@ -141,16 +141,16 @@ function is_keystone_enabled {
# cleanup_keystone() - Remove residual data files, anything left over from previous # cleanup_keystone() - Remove residual data files, anything left over from previous
# runs that a clean run would need to clean up # runs that a clean run would need to clean up
function cleanup_keystone { function cleanup_keystone {
if [[ "$WSGI_MODE" == "uwsgi" ]]; then # TODO: remove admin at pike-2
# TODO: remove admin at pike-2 # These files will be created if we are running WSGI_MODE="uwsgi"
remove_uwsgi_config "$KEYSTONE_PUBLIC_UWSGI_CONF" "$KEYSTONE_PUBLIC_UWSGI" remove_uwsgi_config "$KEYSTONE_PUBLIC_UWSGI_CONF" "$KEYSTONE_PUBLIC_UWSGI"
remove_uwsgi_config "$KEYSTONE_ADMIN_UWSGI_CONF" "$KEYSTONE_ADMIN_UWSGI" remove_uwsgi_config "$KEYSTONE_ADMIN_UWSGI_CONF" "$KEYSTONE_ADMIN_UWSGI"
sudo rm -f $(apache_site_config_for keystone-wsgi-public) sudo rm -f $(apache_site_config_for keystone-wsgi-public)
sudo rm -f $(apache_site_config_for keystone-wsgi-admin) sudo rm -f $(apache_site_config_for keystone-wsgi-admin)
else
disable_apache_site keystone # These files will be created if we are running WSGI_MODE="mod_wsgi"
sudo rm -f $(apache_site_config_for keystone) disable_apache_site keystone
fi sudo rm -f $(apache_site_config_for keystone)
} }
# _config_keystone_apache_wsgi() - Set WSGI config files of Keystone # _config_keystone_apache_wsgi() - Set WSGI config files of Keystone

View File

@ -69,6 +69,7 @@ function is_placement_enabled {
# cleanup_placement() - Remove residual data files, anything left over from previous # cleanup_placement() - Remove residual data files, anything left over from previous
# runs that a clean run would need to clean up # runs that a clean run would need to clean up
function cleanup_placement { function cleanup_placement {
sudo rm -f $(apache_site_config_for nova-placement-api)
sudo rm -f $(apache_site_config_for placement-api) sudo rm -f $(apache_site_config_for placement-api)
} }