Merge "Also pickup quantum distro dependencies (bug 1080886)."
diff --git a/functions b/functions
index 9f54049..9dab759 100644
--- a/functions
+++ b/functions
@@ -227,6 +227,12 @@
         os_UPDATE=""
         if [[ "Debian,Ubuntu" =~ $os_VENDOR ]]; then
             os_PACKAGE="deb"
+        elif [[ "SUSE LINUX" =~ $os_VENDOR ]]; then
+            lsb_release -d -s | grep -q openSUSE
+            if [[ $? -eq 0 ]]; then
+                os_VENDOR="openSUSE"
+            fi
+            os_PACKAGE="rpm"
         else
             os_PACKAGE="rpm"
         fi
@@ -250,6 +256,23 @@
             os_VENDOR=""
         done
         os_PACKAGE="rpm"
+    elif [[ -r /etc/SuSE-release ]]; then
+        for r in openSUSE "SUSE Linux"; do
+            if [[ "$r" = "SUSE Linux" ]]; then
+                os_VENDOR="SUSE LINUX"
+            else
+                os_VENDOR=$r
+            fi
+
+            if [[ -n "`grep \"$r\" /etc/SuSE-release`" ]]; then
+                os_CODENAME=`grep "CODENAME = " /etc/SuSE-release | sed 's:.* = ::g'`
+                os_RELEASE=`grep "VERSION = " /etc/SuSE-release | sed 's:.* = ::g'`
+                os_UPDATE=`grep "PATCHLEVEL = " /etc/SuSE-release | sed 's:.* = ::g'`
+                break
+            fi
+            os_VENDOR=""
+        done
+        os_PACKAGE="rpm"
     fi
     export os_VENDOR os_RELEASE os_UPDATE os_PACKAGE os_CODENAME
 }
@@ -301,6 +324,15 @@
     elif [[ "$os_VENDOR" =~ (Fedora) ]]; then
         # For Fedora, just use 'f' and the release
         DISTRO="f$os_RELEASE"
+    elif [[ "$os_VENDOR" =~ (openSUSE) ]]; then
+        DISTRO="opensuse-$os_RELEASE"
+    elif [[ "$os_VENDOR" =~ (SUSE LINUX) ]]; then
+        # For SLE, also use the service pack
+        if [[ -z "$os_UPDATE" ]]; then
+            DISTRO="sle${os_RELEASE}"
+        else
+            DISTRO="sle${os_RELEASE}sp${os_UPDATE}"
+        fi
     else
         # Catch-all for now is Vendor + Release + Update
         DISTRO="$os_VENDOR-$os_RELEASE.$os_UPDATE"
@@ -309,6 +341,19 @@
 }
 
 
+# Determine if current distribution is a SUSE-based distribution
+# (openSUSE, SLE).
+# is_suse
+function is_suse {
+    if [[ -z "$os_VENDOR" ]]; then
+        GetOSVersion
+    fi
+
+    [[ "$os_VENDOR" = "openSUSE" || "$os_VENDOR" = "SUSE LINUX" ]]
+    return $?
+}
+
+
 # git clone only if directory doesn't exist already.  Since ``DEST`` might not
 # be owned by the installation user, we create the directory and change the
 # ownership to the proper user.
@@ -374,7 +419,7 @@
     local file=$1
     local section=$2
     local option=$3
-    sed -i -e "/^\[$section\]/,/^\[.*\]/ s|^\($option[ \t]*=.*$\)|#\1|" $file
+    sed -ie "/^\[ *$section *\]/,/^\[.*\]/ s|^\($option[ \t]*=.*$\)|#\1|" $file
 }
 
 # Uncomment an option in an INI file
@@ -383,7 +428,7 @@
     local file=$1
     local section=$2
     local option=$3
-    sed -i -e "/^\[$section\]/,/^\[.*\]/ s|[^ \t]*#[ \t]*\($option[ \t]*=.*$\)|\1|" $file
+    sed -ie "/^\[ *$section *\]/,/^\[.*\]/ s|[^ \t]*#[ \t]*\($option[ \t]*=.*$\)|\1|" $file
 }
 
 
@@ -394,7 +439,7 @@
     local section=$2
     local option=$3
     local line
-    line=$(sed -ne "/^\[$section\]/,/^\[.*\]/ { /^$option[ \t]*=/ p; }" $file)
+    line=$(sed -ne "/^\[ *$section *\]/,/^\[.*\]/ { /^$option[ \t]*=/ p; }" $file)
     echo ${line#*=}
 }
 
@@ -406,18 +451,18 @@
     local section=$2
     local option=$3
     local value=$4
-    if ! grep -q "^\[$section\]" $file; then
+    if ! grep -q "^\[ *$section *\]" $file; then
         # Add section at the end
         echo -e "\n[$section]" >>$file
     fi
     if [[ -z "$(iniget $file $section $option)" ]]; then
         # Add it
-        sed -i -e "/^\[$section\]/ a\\
+        sed -ie "/^\[ *$section *\]/ a\\
 $option = $value
 " $file
     else
         # Replace it
-        sed -i -e "/^\[$section\]/,/^\[.*\]/ s|^\($option[ \t]*=[ \t]*\).*$|\1$value|" $file
+        sed -ie "/^\[ *$section *\]/,/^\[.*\]/ s|^\($option[ \t]*=[ \t]*\).*$|\1$value|" $file
     fi
 }
 
@@ -546,7 +591,11 @@
 
         apt_get install "$@"
     else
-        yum_install "$@"
+        if is_suse; then
+            zypper_install "$@"
+        else
+            yum_install "$@"
+        fi
     fi
 }
 
@@ -597,7 +646,7 @@
         SUDO_PIP="env"
     else
         SUDO_PIP="sudo"
-        if [[ "$os_PACKAGE" = "deb" ]]; then
+        if [[ "$os_PACKAGE" = "deb" || is_suse ]]; then
             CMD_PIP=/usr/bin/pip
         else
             CMD_PIP=/usr/bin/pip-python
@@ -950,6 +999,68 @@
     fi
 }
 
+
+# zypper wrapper to set arguments correctly
+# zypper_install package [package ...]
+function zypper_install() {
+    [[ "$OFFLINE" = "True" ]] && return
+    local sudo="sudo"
+    [[ "$(id -u)" = "0" ]] && sudo="env"
+    $sudo http_proxy=$http_proxy https_proxy=$https_proxy \
+        zypper --non-interactive install --auto-agree-with-licenses "$@"
+}
+
+
+# Add a user to a group.
+# add_user_to_group user group
+function add_user_to_group() {
+    local user=$1
+    local group=$2
+
+    if [[ -z "$os_VENDOR" ]]; then
+        GetOSVersion
+    fi
+
+    # SLE11 and openSUSE 12.2 don't have the usual usermod
+    if ! is_suse || [[ "$os_VENDOR" = "openSUSE" && "$os_RELEASE" != "12.2" ]]; then
+        sudo usermod -a -G "$group" "$user"
+    else
+        sudo usermod -A "$group" "$user"
+    fi
+}
+
+
+# Get the location of the $module-rootwrap executables, where module is cinder
+# or nova.
+# get_rootwrap_location module
+function get_rootwrap_location() {
+    local module=$1
+
+    if [[ -z "$os_PACKAGE" ]]; then
+        GetOSVersion
+    fi
+
+    if [[ "$os_PACKAGE" = "deb" || is_suse ]]; then
+        echo "/usr/local/bin/$module-rootwrap"
+    else
+        echo "/usr/bin/$module-rootwrap"
+    fi
+}
+
+
+# Check if qpid can be used on the current distro.
+# qpid_is_supported
+function qpid_is_supported() {
+    if [[ -z "$DISTRO" ]]; then
+        GetDistro
+    fi
+
+    # Qpid was introduced to Ubuntu in precise, disallow it on oneiric; it is
+    # not in openSUSE either right now.
+    [[ "$DISTRO" = "oneiric" || is_suse ]]
+    return $?
+}
+
 # Restore xtrace
 $XTRACE
 
diff --git a/lib/cinder b/lib/cinder
index c2cf15b..058fcc2 100644
--- a/lib/cinder
+++ b/lib/cinder
@@ -63,11 +63,7 @@
     cp -p $CINDER_DIR/etc/cinder/policy.json $CINDER_CONF_DIR
 
     # Set the paths of certain binaries
-    if [[ "$os_PACKAGE" = "deb" ]]; then
-        CINDER_ROOTWRAP=/usr/local/bin/cinder-rootwrap
-    else
-        CINDER_ROOTWRAP=/usr/bin/cinder-rootwrap
-    fi
+    CINDER_ROOTWRAP=$(get_rootwrap_location cinder)
 
     # If Cinder ships the new rootwrap filters files, deploy them
     # (owned by root) and add a parameter to $CINDER_ROOTWRAP
diff --git a/lib/databases/mysql b/lib/databases/mysql
index ed59290..fc6a3b7 100644
--- a/lib/databases/mysql
+++ b/lib/databases/mysql
@@ -25,7 +25,11 @@
         MYSQL=mysql
     else
         MY_CONF=/etc/my.cnf
-        MYSQL=mysqld
+        if is_suse; then
+            MYSQL=mysql
+        else
+            MYSQL=mysqld
+        fi
     fi
 
     # Start mysql-server
diff --git a/lib/horizon b/lib/horizon
new file mode 100644
index 0000000..af09f77
--- /dev/null
+++ b/lib/horizon
@@ -0,0 +1,141 @@
+# lib/horizon
+# Functions to control the configuration and operation of the horizon service
+# <do not include this template file in ``stack.sh``!>
+
+# Dependencies:
+# ``functions`` file
+# ``SERVICE_{TENANT_NAME|PASSWORD}`` must be defined
+# <list other global vars that are assumed to be defined>
+
+# ``stack.sh`` calls the entry points in this order:
+#
+# install_horizon
+# configure_horizon
+# init_horizon
+# start_horizon
+# stop_horizon
+# cleanup_horizon
+
+# Save trace setting
+XTRACE=$(set +o | grep xtrace)
+set +o xtrace
+
+
+# Defaults
+# --------
+
+# <define global variables here that belong to this project>
+
+# Set up default directories
+HORIZON_DIR=$DEST/horizon
+
+# Allow overriding the default Apache user and group, default both to
+# current user.
+APACHE_USER=${APACHE_USER:-$USER}
+APACHE_GROUP=${APACHE_GROUP:-$APACHE_USER}
+
+
+# Entry Points
+# ------------
+
+# cleanup_horizon() - Remove residual data files, anything left over from previous
+# runs that a clean run would need to clean up
+function cleanup_horizon() {
+    # kill instances (nova)
+    # delete image files (glance)
+    # This function intentionally left blank
+    :
+}
+
+# configure_horizon() - Set config files, create data dirs, etc
+function configure_horizon() {
+    setup_develop $HORIZON_DIR
+}
+
+# init_horizon() - Initialize databases, etc.
+function init_horizon() {
+    # Remove stale session database.
+    rm -f $HORIZON_DIR/openstack_dashboard/local/dashboard_openstack.sqlite3
+
+    # ``local_settings.py`` is used to override horizon default settings.
+    local_settings=$HORIZON_DIR/openstack_dashboard/local/local_settings.py
+    cp $FILES/horizon_settings.py $local_settings
+
+    # Initialize the horizon database (it stores sessions and notices shown to
+    # users).  The user system is external (keystone).
+    cd $HORIZON_DIR
+    python manage.py syncdb --noinput
+    cd $TOP_DIR
+
+    # Create an empty directory that apache uses as docroot
+    sudo mkdir -p $HORIZON_DIR/.blackhole
+
+
+    if [[ "$os_PACKAGE" = "deb" ]]; then
+        APACHE_NAME=apache2
+        APACHE_CONF=sites-available/horizon
+        # Clean up the old config name
+        sudo rm -f /etc/apache2/sites-enabled/000-default
+        # Be a good citizen and use the distro tools here
+        sudo touch /etc/$APACHE_NAME/$APACHE_CONF
+        sudo a2ensite horizon
+    else
+        # Install httpd, which is NOPRIME'd
+        if is_suse; then
+            APACHE_NAME=apache2
+            APACHE_CONF=vhosts.d/horizon.conf
+            # Append wsgi to the list of modules to load
+            grep -q "^APACHE_MODULES=.*wsgi" /etc/sysconfig/apache2 ||
+                sudo sed '/^APACHE_MODULES=/s/^\(.*\)"$/\1 wsgi"/' -i /etc/sysconfig/apache2
+        else
+            APACHE_NAME=httpd
+            APACHE_CONF=conf.d/horizon.conf
+            sudo sed '/^Listen/s/^.*$/Listen 0.0.0.0:80/' -i /etc/httpd/conf/httpd.conf
+        fi
+    fi
+
+    # Configure apache to run horizon
+    sudo sh -c "sed -e \"
+        s,%USER%,$APACHE_USER,g;
+        s,%GROUP%,$APACHE_GROUP,g;
+        s,%HORIZON_DIR%,$HORIZON_DIR,g;
+        s,%APACHE_NAME%,$APACHE_NAME,g;
+        s,%DEST%,$DEST,g;
+    \" $FILES/apache-horizon.template >/etc/$APACHE_NAME/$APACHE_CONF"
+
+}
+
+# install_horizon() - Collect source and prepare
+function install_horizon() {
+    # Apache installation, because we mark it NOPRIME
+    if [[ "$os_PACKAGE" = "deb" ]]; then
+        # Install apache2, which is NOPRIME'd
+        install_package apache2 libapache2-mod-wsgi
+    else
+        sudo rm -f /etc/httpd/conf.d/000-*
+        install_package httpd mod_wsgi
+    fi
+
+    # NOTE(sdague) quantal changed the name of the node binary
+    if [[ "$os_PACKAGE" = "deb" ]]; then
+        if [[ ! -e "/usr/bin/node" ]]; then
+            install_package nodejs-legacy
+        fi
+    fi
+
+    git_clone $HORIZON_REPO $HORIZON_DIR $HORIZON_BRANCH $HORIZON_TAG
+}
+
+# start_horizon() - Start running processes, including screen
+function start_horizon() {
+    restart_service $APACHE_NAME
+    screen_it horizon "cd $HORIZON_DIR && sudo tail -f /var/log/$APACHE_NAME/horizon_error.log"
+}
+
+# stop_horizon() - Stop running processes (non-screen)
+function stop_horizon() {
+    stop_service apache2
+}
+
+# Restore xtrace
+$XTRACE
diff --git a/lib/nova b/lib/nova
index b5efce9..d15d9e3 100644
--- a/lib/nova
+++ b/lib/nova
@@ -47,11 +47,7 @@
 fi
 
 # Set the paths of certain binaries
-if [[ "$os_PACKAGE" = "deb" ]]; then
-    NOVA_ROOTWRAP=/usr/local/bin/nova-rootwrap
-else
-    NOVA_ROOTWRAP=/usr/bin/nova-rootwrap
-fi
+NOVA_ROOTWRAP=$(get_rootwrap_location nova)
 
 # Allow rate limiting to be turned off for testing, like for Tempest
 # NOTE: Set API_RATE_LIMIT="False" to turn OFF rate limiting
@@ -252,7 +248,7 @@
 
         # The user that nova runs as needs to be member of **libvirtd** group otherwise
         # nova-compute will be unable to use libvirt.
-        sudo usermod -a -G libvirtd `whoami`
+        add_user_to_group `whoami` libvirtd
 
         # libvirt detects various settings on startup, as we potentially changed
         # the system configuration (modules, filesystems), we need to restart
@@ -432,9 +428,9 @@
     screen_it n-net "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-network"
     screen_it n-sch "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-scheduler"
     screen_it n-novnc "cd $NOVNC_DIR && ./utils/nova-novncproxy --config-file $NOVA_CONF --web ."
-    screen_it n-xvnc "cd $NOVA_DIR && ./bin/nova-xvpvncproxy --config-file $NOVA_CONF"
-    screen_it n-cauth "cd $NOVA_DIR && ./bin/nova-consoleauth"
-    screen_it n-cond "cd $NOVA_DIR && ./bin/nova-conductor"
+    screen_it n-xvnc "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-xvpvncproxy --config-file $NOVA_CONF"
+    screen_it n-cauth "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-consoleauth"
+    screen_it n-cond "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-conductor"
 }
 
 # stop_nova() - Stop running processes (non-screen)
diff --git a/stack.sh b/stack.sh
index 9b830b1..70f4610 100755
--- a/stack.sh
+++ b/stack.sh
@@ -113,9 +113,8 @@
     fi
 fi
 
-# Qpid was introduced to Ubuntu in precise, disallow it on oneiric
-if [ "${DISTRO}" = "oneiric" ] && is_service_enabled qpid ; then
-    echo "You must use Ubuntu Precise or newer for Qpid support."
+if is_service_enabled qpid && ! qpid_is_supported; then
+    echo "Qpid support is not available for this version of your distribution."
     exit 1
 fi
 
@@ -306,6 +305,7 @@
 # ==================
 
 # Get project function libraries
+source $TOP_DIR/lib/horizon
 source $TOP_DIR/lib/keystone
 source $TOP_DIR/lib/glance
 source $TOP_DIR/lib/nova
@@ -317,6 +317,7 @@
 
 # Set the destination directories for OpenStack projects
 HORIZON_DIR=$DEST/horizon
+OPENSTACKCLIENT_DIR=$DEST/python-openstackclient
 NOVNC_DIR=$DEST/noVNC
 SWIFT_DIR=$DEST/swift
 SWIFT3_DIR=$DEST/swift3
@@ -568,15 +569,6 @@
 SERVICE_TENANT_NAME=${SERVICE_TENANT_NAME:-service}
 
 
-# Horizon
-# -------
-
-# Allow overriding the default Apache user and group, default both to
-# current user.
-APACHE_USER=${APACHE_USER:-$USER}
-APACHE_GROUP=${APACHE_GROUP:-$APACHE_USER}
-
-
 # Log files
 # ---------
 
@@ -756,16 +748,6 @@
     install_database
 fi
 
-if is_service_enabled horizon; then
-    if [[ "$os_PACKAGE" = "deb" ]]; then
-        # Install apache2, which is NOPRIME'd
-        install_package apache2 libapache2-mod-wsgi
-    else
-        sudo rm -f /etc/httpd/conf.d/000-*
-        install_package httpd mod_wsgi
-    fi
-fi
-
 if is_service_enabled q-agt; then
     if is_quantum_ovs_base_plugin "$Q_PLUGIN"; then
         # Install deps
@@ -812,6 +794,9 @@
 install_glanceclient
 install_novaclient
 
+# Check out the client libs that are used most
+git_clone $OPENSTACKCLIENT_REPO $OPENSTACKCLIENT_DIR $OPENSTACKCLIENT_BRANCH
+
 # glance, swift middleware and nova api needs keystone middleware
 if is_service_enabled key g-api n-api swift; then
     # unified auth system (manages accounts/tokens)
@@ -840,8 +825,8 @@
     git_clone $NOVNC_REPO $NOVNC_DIR $NOVNC_BRANCH
 fi
 if is_service_enabled horizon; then
-    # django powered web control panel for openstack
-    git_clone $HORIZON_REPO $HORIZON_DIR $HORIZON_BRANCH $HORIZON_TAG
+    # dashboard
+    install_horizon
 fi
 if is_service_enabled quantum; then
     git_clone $QUANTUM_CLIENT_REPO $QUANTUM_CLIENT_DIR $QUANTUM_CLIENT_BRANCH
@@ -877,6 +862,7 @@
 # allowing ``import nova`` or ``import glance.client``
 configure_keystoneclient
 configure_novaclient
+setup_develop $OPENSTACKCLIENT_DIR
 if is_service_enabled key g-api n-api swift; then
     configure_keystone
 fi
@@ -899,7 +885,7 @@
     configure_nova
 fi
 if is_service_enabled horizon; then
-    setup_develop $HORIZON_DIR
+    configure_horizon
 fi
 if is_service_enabled quantum; then
     setup_develop $QUANTUM_CLIENT_DIR
@@ -1035,48 +1021,8 @@
 
 if is_service_enabled horizon; then
     echo_summary "Configuring and starting Horizon"
-
-    # Remove stale session database.
-    rm -f $HORIZON_DIR/openstack_dashboard/local/dashboard_openstack.sqlite3
-
-    # ``local_settings.py`` is used to override horizon default settings.
-    local_settings=$HORIZON_DIR/openstack_dashboard/local/local_settings.py
-    cp $FILES/horizon_settings.py $local_settings
-
-    # Initialize the horizon database (it stores sessions and notices shown to
-    # users).  The user system is external (keystone).
-    cd $HORIZON_DIR
-    python manage.py syncdb --noinput
-    cd $TOP_DIR
-
-    # Create an empty directory that apache uses as docroot
-    sudo mkdir -p $HORIZON_DIR/.blackhole
-
-    if [[ "$os_PACKAGE" = "deb" ]]; then
-        APACHE_NAME=apache2
-        APACHE_CONF=sites-available/horizon
-        # Clean up the old config name
-        sudo rm -f /etc/apache2/sites-enabled/000-default
-        # Be a good citizen and use the distro tools here
-        sudo touch /etc/$APACHE_NAME/$APACHE_CONF
-        sudo a2ensite horizon
-    else
-        # Install httpd, which is NOPRIME'd
-        APACHE_NAME=httpd
-        APACHE_CONF=conf.d/horizon.conf
-        sudo sed '/^Listen/s/^.*$/Listen 0.0.0.0:80/' -i /etc/httpd/conf/httpd.conf
-    fi
-
-    # Configure apache to run horizon
-    sudo sh -c "sed -e \"
-        s,%USER%,$APACHE_USER,g;
-        s,%GROUP%,$APACHE_GROUP,g;
-        s,%HORIZON_DIR%,$HORIZON_DIR,g;
-        s,%APACHE_NAME%,$APACHE_NAME,g;
-        s,%DEST%,$DEST,g;
-    \" $FILES/apache-horizon.template >/etc/$APACHE_NAME/$APACHE_CONF"
-
-    restart_service $APACHE_NAME
+    init_horizon
+    start_horizon
 fi
 
 
@@ -1958,7 +1904,7 @@
     echo_summary "Starting Ceilometer"
     start_ceilometer
 fi
-screen_it horizon "cd $HORIZON_DIR && sudo tail -f /var/log/$APACHE_NAME/horizon_error.log"
+
 screen_it swift "cd $SWIFT_DIR && $SWIFT_DIR/bin/swift-proxy-server ${SWIFT_CONFIG_DIR}/proxy-server.conf -v"
 
 # Starting the nova-objectstore only if swift3 service is not enabled.
diff --git a/stackrc b/stackrc
index 9a244ed..9588cf9 100644
--- a/stackrc
+++ b/stackrc
@@ -76,6 +76,10 @@
 NOVACLIENT_REPO=${GIT_BASE}/openstack/python-novaclient.git
 NOVACLIENT_BRANCH=master
 
+# consolidated openstack python client
+OPENSTACKCLIENT_REPO=${GIT_BASE}/openstack/python-openstackclient.git
+OPENSTACKCLIENT_BRANCH=master
+
 # python keystone client library to nova that horizon uses
 KEYSTONECLIENT_REPO=${GIT_BASE}/openstack/python-keystoneclient
 KEYSTONECLIENT_BRANCH=master
diff --git a/tests/functions.sh b/tests/functions.sh
index 3a0f319..d2cc5c4 100755
--- a/tests/functions.sh
+++ b/tests/functions.sh
@@ -54,6 +54,9 @@
 
 [bbb]
 handlers=ee,ff
+
+[ ccc ]
+spaces  =  yes
 EOF
 
 # Test with spaces
@@ -74,6 +77,14 @@
     echo "iniget failed: $VAL"
 fi
 
+# Test with spaces in section header
+
+VAL=$(iniget test.ini ccc spaces)
+if [[ "$VAL" == "yes" ]]; then
+    echo "OK: $VAL"
+else
+    echo "iniget failed: $VAL"
+fi
 
 # Test without spaces, end of file
 
@@ -112,7 +123,6 @@
     echo "iniget failed: $VAL"
 fi
 
-
 # Test option not exist
 
 VAL=$(iniget test.ini aaa debug)
diff --git a/unstack.sh b/unstack.sh
index 1a2cad8..0040cf1 100755
--- a/unstack.sh
+++ b/unstack.sh
@@ -26,6 +26,7 @@
 
 # Get project function libraries
 source $TOP_DIR/lib/cinder
+source $TOP_DIR/lib/horizon
 
 # Determine what system we are running on.  This provides ``os_VENDOR``,
 # ``os_RELEASE``, ``os_UPDATE``, ``os_PACKAGE``, ``os_CODENAME``
@@ -51,7 +52,7 @@
 
 # Apache has the WSGI processes
 if is_service_enabled horizon; then
-    stop_service apache2
+    stop_horizon
 fi
 
 SCSI_PERSIST_DIR=$CINDER_STATE_PATH/volumes/*