Clean up horizon apache logs on unstack

It feels like the right think to do. Moreover it will avoid to display
horizon errors from a previous devstack run that would be displayed because
of the tail -f in start_horizon()

Change-Id: Id1ab272e60e0733a4feef3b85029f438f2273cb0
This commit is contained in:
JordanP 2013-05-08 22:19:59 +02:00
parent 5f349179f4
commit 1e4587ef99

View File

@ -38,6 +38,18 @@ HORIZON_SETTINGS=${HORIZON_SETTINGS:-$HORIZON_DIR/openstack_dashboard/local/loca
APACHE_USER=${APACHE_USER:-$USER} APACHE_USER=${APACHE_USER:-$USER}
APACHE_GROUP=${APACHE_GROUP:-$(id -gn $APACHE_USER)} APACHE_GROUP=${APACHE_GROUP:-$(id -gn $APACHE_USER)}
# Set up service name and configuration path
if is_ubuntu; then
APACHE_NAME=apache2
APACHE_CONF=sites-available/horizon
elif is_fedora; then
APACHE_NAME=httpd
APACHE_CONF=conf.d/horizon.conf
elif is_suse; then
APACHE_NAME=apache2
APACHE_CONF=vhosts.d/horizon.conf
fi
# Functions # Functions
# --------- # ---------
@ -135,8 +147,6 @@ function init_horizon() {
HORIZON_REQUIRE='' HORIZON_REQUIRE=''
if is_ubuntu; then if is_ubuntu; then
APACHE_NAME=apache2
APACHE_CONF=sites-available/horizon
# Clean up the old config name # Clean up the old config name
sudo rm -f /etc/apache2/sites-enabled/000-default sudo rm -f /etc/apache2/sites-enabled/000-default
# Be a good citizen and use the distro tools here # Be a good citizen and use the distro tools here
@ -145,9 +155,6 @@ function init_horizon() {
# WSGI isn't enabled by default, enable it # WSGI isn't enabled by default, enable it
sudo a2enmod wsgi sudo a2enmod wsgi
elif is_fedora; then elif is_fedora; then
APACHE_NAME=httpd
APACHE_CONF=conf.d/horizon.conf
if [[ "$os_RELEASE" -ge "18" ]]; then if [[ "$os_RELEASE" -ge "18" ]]; then
# fedora 18 has Require all denied in its httpd.conf # fedora 18 has Require all denied in its httpd.conf
# and requires explicit Require all granted # and requires explicit Require all granted
@ -155,14 +162,16 @@ function init_horizon() {
fi fi
sudo sed '/^Listen/s/^.*$/Listen 0.0.0.0:80/' -i /etc/httpd/conf/httpd.conf sudo sed '/^Listen/s/^.*$/Listen 0.0.0.0:80/' -i /etc/httpd/conf/httpd.conf
elif is_suse; then elif is_suse; then
APACHE_NAME=apache2
APACHE_CONF=vhosts.d/horizon.conf
# WSGI isn't enabled by default, enable it # WSGI isn't enabled by default, enable it
sudo a2enmod wsgi sudo a2enmod wsgi
else else
exit_distro_not_supported "apache configuration" exit_distro_not_supported "apache configuration"
fi fi
# Remove old log files that could mess with how devstack detects whether Horizon
# has been successfully started (see start_horizon() and functions::screen_it())
sudo rm -f /var/log/$APACHE_NAME/horizon_*
# Configure apache to run horizon # Configure apache to run horizon
sudo sh -c "sed -e \" sudo sh -c "sed -e \"
s,%USER%,$APACHE_USER,g; s,%USER%,$APACHE_USER,g;
@ -219,12 +228,8 @@ function start_horizon() {
# stop_horizon() - Stop running processes (non-screen) # stop_horizon() - Stop running processes (non-screen)
function stop_horizon() { function stop_horizon() {
if is_ubuntu; then if [ -n "$APACHE_NAME" ]; then
stop_service apache2 stop_service $APACHE_NAME
elif is_fedora; then
stop_service httpd
elif is_suse; then
stop_service apache2
else else
exit_distro_not_supported "apache configuration" exit_distro_not_supported "apache configuration"
fi fi