Merge "Fix libvirt polkit settings"
diff --git a/functions b/functions
index 6979c6c..3101111 100644
--- a/functions
+++ b/functions
@@ -44,60 +44,6 @@
 }
 
 
-# ``pip install -e`` the package, which processes the dependencies
-# using pip before running `setup.py develop`
-#
-# Updates the dependencies in project_dir from the
-# openstack/requirements global list before installing anything.
-#
-# Uses globals ``TRACK_DEPENDS``, ``REQUIREMENTS_DIR``, ``UNDO_REQUIREMENTS``
-# setup_develop directory
-function setup_develop() {
-    local project_dir=$1
-
-    echo "cd $REQUIREMENTS_DIR; $SUDO_CMD python update.py $project_dir"
-
-    # Don't update repo if local changes exist
-    # Don't use buggy "git diff --quiet"
-    (cd $project_dir && git diff --exit-code >/dev/null)
-    local update_requirements=$?
-
-    if [ $update_requirements -eq 0 ]; then
-        (cd $REQUIREMENTS_DIR; \
-            $SUDO_CMD python update.py $project_dir)
-    fi
-
-    setup_develop_no_requirements_update $project_dir
-
-    # We've just gone and possibly modified the user's source tree in an
-    # automated way, which is considered bad form if it's a development
-    # tree because we've screwed up their next git checkin. So undo it.
-    #
-    # However... there are some circumstances, like running in the gate
-    # where we really really want the overridden version to stick. So provide
-    # a variable that tells us whether or not we should UNDO the requirements
-    # changes (this will be set to False in the OpenStack ci gate)
-    if [ $UNDO_REQUIREMENTS = "True" ]; then
-        if [ $update_requirements -eq 0 ]; then
-            (cd $project_dir && git reset --hard)
-        fi
-    fi
-}
-
-
-# ``pip install -e`` the package, which processes the dependencies
-# using pip before running `setup.py develop`
-# Uses globals ``STACK_USER``
-# setup_develop_no_requirements_update directory
-function setup_develop_no_requirements_update() {
-    local project_dir=$1
-
-    pip_install -e $project_dir
-    # ensure that further actions can do things like setup.py sdist
-    safe_chown -R $STACK_USER $1/*.egg-info
-}
-
-
 # Retrieve an image from a URL and upload into Glance.
 # Uses the following variables:
 #
diff --git a/functions-common b/functions-common
index 8b768b1..c93dd85 100644
--- a/functions-common
+++ b/functions-common
@@ -15,6 +15,7 @@
 # - Process Functions
 # - Python Functions
 # - Service Functions
+# - System Functions
 #
 # The following variables are assumed to be defined by certain functions:
 #
@@ -1125,7 +1126,8 @@
     fi
 
     # Check if there is any falure flag file under $SERVICE_DIR/$SCREEN_NAME
-    failures=`ls "$SERVICE_DIR/$SCREEN_NAME"/*.failure 2>/dev/null`
+    # make this -o errexit safe
+    failures=`ls "$SERVICE_DIR/$SCREEN_NAME"/*.failure 2>/dev/null || /bin/true`
 
     for service in $failures; do
         service=`basename $service`
@@ -1212,6 +1214,58 @@
         && $SUDO_PIP rm -rf ${pip_build_tmp}
 }
 
+# ``pip install -e`` the package, which processes the dependencies
+# using pip before running `setup.py develop`
+#
+# Updates the dependencies in project_dir from the
+# openstack/requirements global list before installing anything.
+#
+# Uses globals ``TRACK_DEPENDS``, ``REQUIREMENTS_DIR``, ``UNDO_REQUIREMENTS``
+# setup_develop directory
+function setup_develop() {
+    local project_dir=$1
+
+    echo "cd $REQUIREMENTS_DIR; $SUDO_CMD python update.py $project_dir"
+
+    # Don't update repo if local changes exist
+    # Don't use buggy "git diff --quiet"
+    (cd $project_dir && git diff --exit-code >/dev/null)
+    local update_requirements=$?
+
+    if [ $update_requirements -eq 0 ]; then
+        (cd $REQUIREMENTS_DIR; \
+            $SUDO_CMD python update.py $project_dir)
+    fi
+
+    setup_develop_no_requirements_update $project_dir
+
+    # We've just gone and possibly modified the user's source tree in an
+    # automated way, which is considered bad form if it's a development
+    # tree because we've screwed up their next git checkin. So undo it.
+    #
+    # However... there are some circumstances, like running in the gate
+    # where we really really want the overridden version to stick. So provide
+    # a variable that tells us whether or not we should UNDO the requirements
+    # changes (this will be set to False in the OpenStack ci gate)
+    if [ $UNDO_REQUIREMENTS = "True" ]; then
+        if [ $update_requirements -eq 0 ]; then
+            (cd $project_dir && git reset --hard)
+        fi
+    fi
+}
+
+# ``pip install -e`` the package, which processes the dependencies
+# using pip before running `setup.py develop`
+# Uses globals ``STACK_USER``
+# setup_develop_no_requirements_update directory
+function setup_develop_no_requirements_update() {
+    local project_dir=$1
+
+    pip_install -e $project_dir
+    # ensure that further actions can do things like setup.py sdist
+    safe_chown -R $STACK_USER $1/*.egg-info
+}
+
 
 # Service Functions
 # =================
@@ -1366,8 +1420,8 @@
 }
 
 
-# System Function
-# ===============
+# System Functions
+# ================
 
 # Only run the command if the target file (the last arg) is not on an
 # NFS filesystem.
diff --git a/lib/keystone b/lib/keystone
index 73af1d3..1833301 100644
--- a/lib/keystone
+++ b/lib/keystone
@@ -70,6 +70,8 @@
 KEYSTONE_SERVICE_PORT_INT=${KEYSTONE_SERVICE_PORT_INT:-5001}
 KEYSTONE_SERVICE_PROTOCOL=${KEYSTONE_SERVICE_PROTOCOL:-$SERVICE_PROTOCOL}
 
+# Bind hosts
+KEYSTONE_ADMIN_BIND_HOST=${KEYSTONE_ADMIN_BIND_HOST:-$KEYSTONE_SERVICE_HOST}
 # Set the tenant for service accounts in Keystone
 SERVICE_TENANT_NAME=${SERVICE_TENANT_NAME:-service}
 
@@ -178,7 +180,7 @@
     # Set the URL advertised in the ``versions`` structure returned by the '/' route
     iniset $KEYSTONE_CONF DEFAULT public_endpoint "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:%(public_port)s/"
     iniset $KEYSTONE_CONF DEFAULT admin_endpoint "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:%(admin_port)s/"
-    iniset $KEYSTONE_CONF DEFAULT admin_bind_host "$KEYSTONE_SERVICE_HOST"
+    iniset $KEYSTONE_CONF DEFAULT admin_bind_host "$KEYSTONE_ADMIN_BIND_HOST"
 
     # Register SSL certificates if provided
     if is_ssl_enabled_service key; then
diff --git a/lib/neutron_plugins/services/loadbalancer b/lib/neutron_plugins/services/loadbalancer
index 5d7a94e..3714142 100644
--- a/lib/neutron_plugins/services/loadbalancer
+++ b/lib/neutron_plugins/services/loadbalancer
@@ -38,6 +38,7 @@
 
     if is_fedora; then
         iniset $LBAAS_AGENT_CONF_FILENAME DEFAULT user_group "nobody"
+        iniset $LBAAS_AGENT_CONF_FILENAME haproxy user_group "nobody"
     fi
 }
 
diff --git a/lib/savanna b/lib/savanna
index 954f0e7..9feff23 100644
--- a/lib/savanna
+++ b/lib/savanna
@@ -135,6 +135,12 @@
         iniset $SAVANNA_CONF_FILE DEFAULT use_floating_ips true
     fi
 
+    if is_service_enabled heat; then
+        iniset $SAVANNA_CONF_FILE DEFAULT infrastructure_engine heat
+    else
+        iniset $SAVANNA_CONF_FILE DEFAULT infrastructure_engine savanna
+    fi
+
     iniset $SAVANNA_CONF_FILE DEFAULT use_syslog $SYSLOG
 
     recreate_database savanna utf8
diff --git a/stack.sh b/stack.sh
index 4333fb2..ac89e52 100755
--- a/stack.sh
+++ b/stack.sh
@@ -605,6 +605,9 @@
     exit $r
 }
 
+
+set -o errexit
+
 # Print the commands being run so that we can see the command that triggers
 # an error.  It is also useful for following along as the install occurs.
 set -o xtrace