Merge "Stop trying to create the 'ironic' user twice"
diff --git a/functions-common b/functions-common
index 2248fbb..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:
 #
@@ -1419,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/nova_plugins/hypervisor-libvirt b/lib/nova_plugins/hypervisor-libvirt
index a550600..dc999ed 100644
--- a/lib/nova_plugins/hypervisor-libvirt
+++ b/lib/nova_plugins/hypervisor-libvirt
@@ -87,7 +87,7 @@
             cat <<EOF | sudo tee $rules_dir/50-libvirt-$STACK_USER.rules
 polkit.addRule(function(action, subject) {
     if (action.id == 'org.libvirt.unix.manage' &&
-        subject.user == '"$STACK_USER"') {
+        subject.user == '$STACK_USER') {
         return polkit.Result.YES;
     }
 });
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 ac89e52..ac23db0 100755
--- a/stack.sh
+++ b/stack.sh
@@ -5,11 +5,12 @@
 # **Glance**, **Heat**, **Horizon**, **Keystone**, **Nova**, **Neutron**,
 # and **Swift**
 
-# This script allows you to specify configuration options of what git
-# repositories to use, enabled services, network configuration and various
-# passwords.  If you are crafty you can run the script on multiple nodes using
-# shared settings for common resources (mysql, rabbitmq) and build a multi-node
-# developer install.
+# This script's options can be changed by setting appropriate environment
+# variables.  You can configure things like which git repositories to use,
+# services to enable, OS images to use, etc.  Default values are located in the
+# ``stackrc`` file. If you are crafty you can run the script on multiple nodes
+# using shared settings for common resources (eg., mysql or rabbitmq) and build
+# a multi-node developer install.
 
 # To keep this script simple we assume you are running on a recent **Ubuntu**
 # (12.04 Precise or newer) or **Fedora** (F18 or newer) machine.  (It may work
@@ -30,6 +31,9 @@
 LC_ALL=C
 export LC_ALL
 
+# Make sure umask is sane
+umask 022
+
 # Keep track of the devstack directory
 TOP_DIR=$(cd $(dirname "$0") && pwd)
 
@@ -587,8 +591,11 @@
 trap exit_trap EXIT
 function exit_trap {
     local r=$?
-    echo "exit_trap called, cleaning up child processes"
-    kill 2>&1 $(jobs -p)
+    jobs=$(jobs -p)
+    if [[ -n $jobs ]]; then
+        echo "exit_trap: cleaning up child processes"
+        kill 2>&1 $jobs
+    fi
     exit $r
 }