Merge "Modified ceilometer alarm evaluator console script"
diff --git a/files/ldap/base-config.ldif b/files/ldap/base-config.ldif
new file mode 100644
index 0000000..026d8bc
--- /dev/null
+++ b/files/ldap/base-config.ldif
@@ -0,0 +1,19 @@
+dn: cn=config
+objectClass: olcGlobal
+cn: config
+olcArgsFile: /var/run/slapd/slapd.args
+olcAuthzRegexp: {0}gidNumber=0\+uidNumber=0,cn=peercred,cn=external,cn=auth dn
+ :cn=config
+olcPidFile: /var/run/slapd/slapd.pid
+olcSizeLimit: 10000
+
+dn: cn=schema,cn=config
+objectClass: olcSchemaConfig
+cn: schema
+
+include: file:///etc/openldap/schema/core.ldif
+
+dn: olcDatabase={1}hdb,cn=config
+objectClass: olcHdbConfig
+olcDbDirectory: /var/lib/ldap
+olcSuffix: dc=openstack,dc=org
diff --git a/functions b/functions
index e1a5f4b..209f13c 100644
--- a/functions
+++ b/functions
@@ -548,12 +548,18 @@
 # Uses global ``OFFLINE``
 # git_clone remote dest-dir branch
 function git_clone {
-    [[ "$OFFLINE" = "True" ]] && return
-
     GIT_REMOTE=$1
     GIT_DEST=$2
     GIT_REF=$3
 
+    if [[ "$OFFLINE" = "True" ]]; then
+        echo "Running in offline mode, clones already exist"
+        # print out the results so we know what change was used in the logs
+        cd $GIT_DEST
+        git show --oneline
+        return
+    fi
+
     if echo $GIT_REF | egrep -q "^refs"; then
         # If our branch name is a gerrit style refs/changes/...
         if [[ ! -d $GIT_DEST ]]; then
@@ -595,6 +601,10 @@
 
         fi
     fi
+
+    # print out the results so we know what change was used in the logs
+    cd $GIT_DEST
+    git show --oneline
 }
 
 
diff --git a/lib/apache b/lib/apache
index a2b0534..d811f87 100644
--- a/lib/apache
+++ b/lib/apache
@@ -4,7 +4,6 @@
 # Dependencies:
 # ``functions`` file
 # is_apache_enabled_service
-# change_apache_user_group
 # install_apache_wsgi
 # config_apache_wsgi
 # start_apache_server
@@ -52,29 +51,6 @@
     return 1
 }
 
-# change_apache_user_group() - Change the User/Group to run Apache server
-function change_apache_user_group(){
-    local stack_user=$@
-    if is_ubuntu; then
-        sudo sed -e "
-            s/^export APACHE_RUN_USER=.*/export APACHE_RUN_USER=${stack_user}/g;
-            s/^export APACHE_RUN_GROUP=.*/export APACHE_RUN_GROUP=${stack_user}/g
-        " -i /etc/${APACHE_NAME}/envvars
-    elif is_fedora; then
-        sudo sed -e "
-            s/^User .*/User ${stack_user}/g;
-            s/^Group .*/Group ${stack_user}/g
-        " -i /etc/${APACHE_NAME}/httpd.conf
-    elif is_suse; then
-        sudo sed -e "
-            s/^User .*/User ${stack_user}/g;
-            s/^Group .*/Group ${stack_user}/g
-        " -i /etc/${APACHE_NAME}/uid.conf
-    else
-        exit_distro_not_supported "apache user and group"
-    fi
-}
-
 # install_apache_wsgi() - Install Apache server and wsgi module
 function install_apache_wsgi() {
     # Apache installation, because we mark it NOPRIME
diff --git a/lib/ldap b/lib/ldap
index 89b31b2..2a24ccd 100644
--- a/lib/ldap
+++ b/lib/ldap
@@ -8,6 +8,7 @@
 XTRACE=$(set +o | grep xtrace)
 set +o xtrace
 
+LDAP_SERVICE_NAME=slapd
 
 # Functions
 # ---------
@@ -24,10 +25,19 @@
         LDAP_ROOTPW_COMMAND=replace
         sudo DEBIAN_FRONTEND=noninteractive apt-get install slapd ldap-utils
         #automatically starts LDAP on ubuntu so no need to call start_ldap
-    elif is_fedora || is_suse; then
+    elif is_fedora; then
         LDAP_OLCDB_NUMBER=2
         LDAP_ROOTPW_COMMAND=add
         start_ldap
+    elif is_suse; then
+        LDAP_OLCDB_NUMBER=1
+        LDAP_ROOTPW_COMMAND=add
+        LDAP_SERVICE_NAME=ldap
+        # SUSE has slappasswd in /usr/sbin/
+        PATH=$PATH:/usr/sbin/
+        sudo slapadd -F /etc/openldap/slapd.d/ -bcn=config -l $FILES/ldap/base-config.ldif
+        sudo sed -i '/^OPENLDAP_START_LDAPI=/s/"no"/"yes"/g' /etc/sysconfig/openldap
+        start_ldap
     fi
 
     printf "generate password file"
@@ -42,7 +52,7 @@
     sudo ldapmodify -Y EXTERNAL -H ldapi:/// -f $TMP_MGR_DIFF_FILE
 
     # On fedora we need to manually add cosine and inetorgperson schemas
-    if is_fedora; then
+    if is_fedora || is_suse; then
         sudo ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/cosine.ldif
         sudo ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/inetorgperson.ldif
     fi
@@ -64,13 +74,13 @@
 
 # start_ldap() - Start LDAP
 function start_ldap() {
-    sudo service slapd restart
+    sudo service $LDAP_SERVICE_NAME restart
 }
 
 
 # stop_ldap() - Stop LDAP
 function stop_ldap() {
-    sudo service slapd stop
+    sudo service $LDAP_SERVICE_NAME stop
 }
 
 # clear_ldap_state() - Clear LDAP State
diff --git a/lib/swift b/lib/swift
index 25d443d..8741e55 100644
--- a/lib/swift
+++ b/lib/swift
@@ -203,9 +203,6 @@
 
     done
 
-    # run apache server as stack user
-    change_apache_user_group ${STACK_USER}
-
     # WSGI isn't enabled by default, enable it
     ! is_fedora && sudo a2enmod wsgi
 }
@@ -562,10 +559,6 @@
     fi
 
     if is_apache_enabled_service swift; then
-        # Make sure the apache lock dir is owned by $STACK_USER
-        # for running apache server to avoid failure of restarting
-        # apache server due to permission problem.
-        sudo chown -R $STACK_USER /var/run/lock/$APACHE_NAME
         restart_apache_server
         swift-init --run-dir=${SWIFT_DATA_DIR}/run rest start
         screen_it s-proxy "cd $SWIFT_DIR && sudo tail -f /var/log/$APACHE_NAME/proxy-server"
diff --git a/tools/docker/install_docker.sh b/tools/docker/install_docker.sh
index d659ad1..289002e 100755
--- a/tools/docker/install_docker.sh
+++ b/tools/docker/install_docker.sh
@@ -38,7 +38,7 @@
 install_package python-software-properties && \
     sudo sh -c "echo deb $DOCKER_APT_REPO docker main > /etc/apt/sources.list.d/docker.list"
 apt_get update
-install_package --force-yes lxc-docker=${DOCKER_PACKAGE_VERSION}
+install_package --force-yes lxc-docker=${DOCKER_PACKAGE_VERSION} socat
 
 # Start the daemon - restart just in case the package ever auto-starts...
 restart_service docker
diff --git a/tools/xen/install_os_domU.sh b/tools/xen/install_os_domU.sh
index b49504d..110bbd9 100755
--- a/tools/xen/install_os_domU.sh
+++ b/tools/xen/install_os_domU.sh
@@ -10,6 +10,8 @@
 set -o nounset
 set -o xtrace
 
+export LC_ALL=C
+
 # Abort if localrc is not set
 if [ ! -e ../../localrc ]; then
     echo "You must have a localrc with ALL necessary passwords defined before proceeding."