remove config files when run clean.sh

Currently we don't remove Ceilometer config files when ./clean.sh
is run, which should be fixed because it will bite developers when
they test change related to devstack script.

Note, this patch also removes ceilometer api log files when WSGI
is not enabled.

Change-Id: I3fd62787708cf64d1860b2b64d25773e79b17fe9
Closes-Bug: #1509253
This commit is contained in:
ZhiQiang Fan 2015-11-25 01:45:20 +08:00
parent 096e98d34d
commit af85965f55
1 changed files with 18 additions and 10 deletions

View File

@ -190,13 +190,14 @@ function preinstall_ceilometer {
# Remove WSGI files, disable and remove Apache vhost file
function _ceilometer_cleanup_apache_wsgi {
sudo rm -f $CEILOMETER_WSGI_DIR/*
sudo rm -f $(apache_site_config_for ceilometer)
if is_service_enabled ceilometer-api && [ "$CEILOMETER_USE_MOD_WSGI" == "True" ]; then
sudo rm -f "$CEILOMETER_WSGI_DIR"/*
sudo rmdir "$CEILOMETER_WSGI_DIR"
sudo rm -f $(apache_site_config_for ceilometer)
fi
}
# cleanup_ceilometer() - Remove residual data files, anything left over
# from previous runs that a clean run would need to clean up
function cleanup_ceilometer {
function _drop_database {
if is_service_enabled ceilometer-collector ceilometer-api ; then
if [ "$CEILOMETER_BACKEND" = 'mongodb' ] ; then
mongo ceilometer --eval "db.dropDatabase();"
@ -204,9 +205,18 @@ function cleanup_ceilometer {
curl -XDELETE "localhost:9200/events_*"
fi
fi
}
if is_service_enabled ceilometer-api && [ "$CEILOMETER_USE_MOD_WSGI" == "True" ]; then
_ceilometer_cleanup_apache_wsgi
# cleanup_ceilometer() - Remove residual data files, anything left over
# from previous runs that a clean run would need to clean up
function cleanup_ceilometer {
_ceilometer_cleanup_apache_wsgi
_drop_database
sudo rm -f "$CEILOMETER_CONF_DIR"/*
sudo rmdir "$CEILOMETER_CONF_DIR"
if is_service_enabled ceilometer-api && [ "$CEILOMETER_USE_MOD_WSGI" == "False" ]; then
sudo rm -f "$CEILOMETER_API_LOG_DIR"/*
sudo rmdir "$CEILOMETER_API_LOG_DIR"
fi
}
@ -229,7 +239,7 @@ function _ceilometer_configure_storage_backend {
else
die $LINENO "Unable to configure unknown CEILOMETER_BACKEND $CEILOMETER_BACKEND"
fi
cleanup_ceilometer
_drop_database
}
# Configure Ceilometer
@ -296,8 +306,6 @@ function configure_ceilometer {
iniset $CEILOMETER_CONF vmware host_password "$VMWAREAPI_PASSWORD"
fi
# NOTE: This must come after database configurate as those can
# call cleanup_ceilometer which will wipe the WSGI config.
if is_service_enabled ceilometer-api && [ "$CEILOMETER_USE_MOD_WSGI" == "True" ]; then
iniset $CEILOMETER_CONF api pecan_debug "False"
_ceilometer_config_apache_wsgi