Merge "Only enable auth_token in swift with keystone"
diff --git a/clean.sh b/clean.sh
index 7851da3..e2374e7 100755
--- a/clean.sh
+++ b/clean.sh
@@ -120,9 +120,9 @@
 
 # Clean up files
 
-FILES_TO_CLEAN=".localrc.auto docs-files docs/ shocco/ stack-screenrc test*.conf* test.ini*"
+FILES_TO_CLEAN=".localrc.auto docs/files docs/html shocco/ stack-screenrc test*.conf* test.ini*"
 FILES_TO_CLEAN+=".stackenv .prereqs"
 
 for file in $FILES_TO_CLEAN; do
-    rm -f $TOP_DIR/$file
+    rm -rf $TOP_DIR/$file
 done
diff --git a/files/apts/general b/files/apts/general
index d81ec7a..90529e5 100644
--- a/files/apts/general
+++ b/files/apts/general
@@ -22,3 +22,4 @@
 python-dev
 python2.7
 bc
+libyaml-dev
diff --git a/files/rpms/general b/files/rpms/general
index c940de6..a0074dd 100644
--- a/files/rpms/general
+++ b/files/rpms/general
@@ -23,6 +23,7 @@
 wget
 which
 bc
+libyaml-devel
 
 # [1] : some of installed tools have unversioned dependencies on this,
 # but others have versioned (<=0.7).  So if a later version (0.7.1)
diff --git a/lib/ceilometer b/lib/ceilometer
index eef6740..8ce9fb4 100644
--- a/lib/ceilometer
+++ b/lib/ceilometer
@@ -53,6 +53,9 @@
 CEILOMETER_SERVICE_HOST=$SERVICE_HOST
 CEILOMETER_SERVICE_PORT=${CEILOMETER_SERVICE_PORT:-8777}
 
+# To enable OSprofiler change value of this variable to "notifications,profiler"
+CEILOMETER_NOTIFICATION_TOPICS=${CEILOMETER_NOTIFICATION_TOPICS:-notifications}
+
 # Tell Tempest this project is present
 TEMPEST_SERVICES+=,ceilometer
 
@@ -141,7 +144,7 @@
 
     iniset_rpc_backend ceilometer $CEILOMETER_CONF DEFAULT
 
-    iniset $CEILOMETER_CONF DEFAULT notification_topics 'notifications'
+    iniset $CEILOMETER_CONF DEFAULT notification_topics "$CEILOMETER_NOTIFICATION_TOPICS"
     iniset $CEILOMETER_CONF DEFAULT verbose True
     iniset $CEILOMETER_CONF DEFAULT debug "$ENABLE_DEBUG_LOG_LEVEL"
 
diff --git a/lib/keystone b/lib/keystone
index 41ed4c1..8a4683f 100644
--- a/lib/keystone
+++ b/lib/keystone
@@ -39,6 +39,7 @@
 KEYSTONE_AUTH_CACHE_DIR=${KEYSTONE_AUTH_CACHE_DIR:-/var/cache/keystone}
 KEYSTONE_WSGI_DIR=${KEYSTONE_WSGI_DIR:-/var/www/keystone}
 
+KEYSTONEMIDDLEWARE_DIR=$DEST/keystonemiddleware
 KEYSTONECLIENT_DIR=$DEST/python-keystoneclient
 
 # Set up additional extensions, such as oauth1, federation
@@ -438,6 +439,12 @@
     sudo install -D -m 0644 -o $STACK_USER {$KEYSTONECLIENT_DIR/tools/,/etc/bash_completion.d/}keystone.bash_completion
 }
 
+# install_keystonemiddleware() - Collect source and prepare
+function install_keystonemiddleware {
+    git_clone $KEYSTONEMIDDLEWARE_REPO $KEYSTONEMIDDLEWARE_DIR $KEYSTONEMIDDLEWARE_BRANCH
+    setup_install $KEYSTONEMIDDLEWARE_DIR
+}
+
 # install_keystone() - Collect source and prepare
 function install_keystone {
     # only install ldap if the service has been enabled
diff --git a/lib/trove b/lib/trove
index 401ab78..98ab56d 100644
--- a/lib/trove
+++ b/lib/trove
@@ -36,7 +36,6 @@
 TROVE_DATASTORE_TYPE=${TROVE_DATASTORE_TYPE:-"mysql"}
 TROVE_DATASTORE_VERSION=${TROVE_DATASTORE_VERSION:-"5.5"}
 TROVE_DATASTORE_PACKAGE=${TROVE_DATASTORE_PACKAGE:-"mysql-server-5.5"}
-TROVE_GUEST_IMAGE_URL=${TROVE_GUEST_IMAGE_URL:-"http://tarballs.openstack.org/trove/images/ubuntu_mysql.qcow2/ubuntu_mysql.qcow2"}
 
 # Support entry points installation of console scripts
 if [[ -d $TROVE_DIR/bin ]]; then
diff --git a/stack.sh b/stack.sh
index ab6dcf3..e58436d 100755
--- a/stack.sh
+++ b/stack.sh
@@ -722,6 +722,9 @@
     install_heatclient
 fi
 
+# Install middleware
+install_keystonemiddleware
+
 git_clone $OPENSTACKCLIENT_REPO $OPENSTACKCLIENT_DIR $OPENSTACKCLIENT_BRANCH
 setup_develop $OPENSTACKCLIENT_DIR
 
diff --git a/stackrc b/stackrc
index 840f3ac..3923d38 100644
--- a/stackrc
+++ b/stackrc
@@ -35,17 +35,19 @@
 #  # Optional, to enable tempest configuration as part of devstack
 #  enable_service tempest
 
-# core compute (glance / keystone / nova (+ nova-network))
-ENABLED_SERVICES=g-api,g-reg,key,n-api,n-crt,n-obj,n-cpu,n-net,n-cond,n-sch,n-novnc,n-xvnc,n-cauth
-# cinder
-ENABLED_SERVICES+=,c-sch,c-api,c-vol
-# heat
-ENABLED_SERVICES+=,h-eng,h-api,h-api-cfn,h-api-cw
-# dashboard
-ENABLED_SERVICES+=,horizon
-# additional services
-ENABLED_SERVICES+=,rabbit,tempest,mysql
-
+# this allows us to pass ENABLED_SERVICES
+if [[ -z "$ENABLED_SERVICES" ]]; then
+    # core compute (glance / keystone / nova (+ nova-network))
+    ENABLED_SERVICES=g-api,g-reg,key,n-api,n-crt,n-obj,n-cpu,n-net,n-cond,n-sch,n-novnc,n-xvnc,n-cauth
+    # cinder
+    ENABLED_SERVICES+=,c-sch,c-api,c-vol
+    # heat
+    ENABLED_SERVICES+=,h-eng,h-api,h-api-cfn,h-api-cw
+    # dashboard
+    ENABLED_SERVICES+=,horizon
+    # additional services
+    ENABLED_SERVICES+=,rabbit,tempest,mysql
+fi
 
 # Tell Tempest which services are available.  The default is set here as
 # Tempest falls late in the configuration sequence.  This differs from
@@ -153,6 +155,10 @@
 KEYSTONECLIENT_REPO=${KEYSTONECLIENT_REPO:-${GIT_BASE}/openstack/python-keystoneclient.git}
 KEYSTONECLIENT_BRANCH=${KEYSTONECLIENT_BRANCH:-master}
 
+# keystone middleware
+KEYSTONEMIDDLEWARE_REPO=${KEYSTONEMIDDLEWARE_REPO:-${GIT_BASE}/openstack/keystonemiddleware.git}
+KEYSTONEMIDDLEWARE_BRANCH=${KEYSTONEMIDDLEWARE_BRANCH:-master}
+
 # compute service
 NOVA_REPO=${NOVA_REPO:-${GIT_BASE}/openstack/nova.git}
 NOVA_BRANCH=${NOVA_BRANCH:-master}
@@ -354,19 +360,35 @@
 if [[ "$ENABLED_SERVICES" =~ 'h-api' ]]; then
     case "$VIRT_DRIVER" in
         libvirt|baremetal|ironic)
-            HEAT_CFN_IMAGE_URL=${HEAT_CFN_IMAGE_URL:-"https://dl.fedoraproject.org/pub/fedora/linux/releases/20/Images/x86_64/Fedora-x86_64-20-20131211.1-sda.qcow2"}
+            HEAT_CFN_IMAGE_URL=${HEAT_CFN_IMAGE_URL:-"http://dl.fedoraproject.org/pub/alt/openstack/20/x86_64/Fedora-x86_64-20-20140618-sda.qcow2"}
             IMAGE_URLS+=",$HEAT_CFN_IMAGE_URL"
             ;;
         *)
             ;;
     esac
 fi
+
+# Trove needs a custom image for it's work
+if [[ "$ENABLED_SERVICES" =~ 'tr-api' ]]; then
+    case "$VIRT_DRIVER" in
+        libvirt|baremetal|ironic)
+            TROVE_GUEST_IMAGE_URL=${TROVE_GUEST_IMAGE_URL:-"http://tarballs.openstack.org/trove/images/ubuntu_mysql.qcow2/ubuntu_mysql.qcow2"}
+            IMAGE_URLS+=",${TROVE_GUEST_IMAGE_URL}"
+            ;;
+        *)
+            ;;
+    esac
+fi
+
 # Staging Area for New Images, have them here for at least 24hrs for nodepool
 # to cache them otherwise the failure rates in the gate are too high
 PRECACHE_IMAGES=$(trueorfalse False $PRECACHE_IMAGES)
 if [[ "$PRECACHE_IMAGES" == "True" ]]; then
     # staging in update for nodepool
-    IMAGE_URLS+=",http://dl.fedoraproject.org/pub/alt/openstack/20/x86_64/Fedora-x86_64-20-20140618-sda.qcow2"
+    IMAGE_URL="http://dl.fedoraproject.org/pub/alt/openstack/20/x86_64/Fedora-x86_64-20-20140618-sda.qcow2"
+    if ! [[ "$IMAGE_URLS"  =~ "$IMAGE_URL" ]]; then
+        IMAGE_URLS+=",$IMAGE_URL"
+    fi
 fi
 
 # 10Gb default volume backing file size
diff --git a/tools/image_list.sh b/tools/image_list.sh
index f9a4e2f..0bb49ab 100755
--- a/tools/image_list.sh
+++ b/tools/image_list.sh
@@ -10,7 +10,7 @@
 DRIVERS="openvz ironic libvirt vsphere xenserver dummy"
 
 # Extra variables to trigger getting additional images.
-ENABLED_SERVICES=h-api
+export ENABLED_SERVICES="h-api,tr-api"
 HEAT_FETCHED_TEST_IMAGE="Fedora-i386-20-20131211.1-sda"
 PRECACHE_IMAGES=True