Use default swift pipeline and add extras.
- By default use the default pipeline as shipped with swift.
- Add option SWIFT_EXTRAS_MIDDLEWARE which by default include tempurl
formpost staticweb bulk to enable extra featuress.
- Clean pids in cleanup_swift Fix bug 1140364.
Rebased
Change-Id: Ida537ae8d3e319a5b84546f82ebf00615f070be1
diff --git a/lib/swift b/lib/swift
index 73ef6d8..2c87d21 100644
--- a/lib/swift
+++ b/lib/swift
@@ -46,6 +46,10 @@
# Default is 1 gigabyte.
SWIFT_LOOPBACK_DISK_SIZE=${SWIFT_LOOPBACK_DISK_SIZE:-1000000}
+# Set ``SWIFT_EXTRAS_MIDDLEWARE`` to extras middlewares.
+# Default is ``staticweb, tempurl, bulk, formpost``
+SWIFT_EXTRAS_MIDDLEWARE=${SWIFT_EXTRAS_MIDDLEWARE:-tempurl formpost staticweb bulk}
+
# The ring uses a configurable number of bits from a path’s MD5 hash as
# a partition index that designates a device. The number of bits kept
# from the hash is known as the partition power, and 2 to the partition
@@ -85,11 +89,12 @@
if [[ -e ${SWIFT_DATA_DIR}/drives/images/swift.img ]]; then
rm ${SWIFT_DATA_DIR}/drives/images/swift.img
fi
+ rm -rf ${SWIFT_DATA_DIR}/run/
}
# configure_swift() - Set config files, create data dirs and loop image
function configure_swift() {
- local swift_auth_server
+ local swift_pipeline=" "
local node_number
local swift_node_config
local swift_log_dir
@@ -200,10 +205,21 @@
iniuncomment ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT bind_port
iniset ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT bind_port ${SWIFT_DEFAULT_BIND_PORT:-8080}
- # Only enable Swift3 if we have it enabled in ENABLED_SERVICES
- is_service_enabled swift3 && swift3=swift3 || swift3=""
-
- iniset ${SWIFT_CONFIG_PROXY_SERVER} pipeline:main pipeline "catch_errors healthcheck cache ratelimit ${swift3} ${swift_auth_server} proxy-logging proxy-server"
+ # By default Swift will be installed with the tempauth middleware
+ # which has some default username and password if you have
+ # configured keystone it will configure swift with it.
+ if is_service_enabled key;then
+ if is_service_enabled swift3;then
+ swift_pipeline=" s3token swift3 "
+ fi
+ swift_pipeline+=" authtoken keystoneauth "
+ else
+ if is_service_enabled swift3;then
+ swift_pipeline=" swift3 "
+ fi
+ swift_pipeline+=" tempauth "
+ fi
+ sed -i "/^pipeline/ { s/tempauth/${swift_pipeline} ${SWIFT_EXTRAS_MIDDLEWARE}/ ;}" ${SWIFT_CONFIG_PROXY_SERVER}
iniset ${SWIFT_CONFIG_PROXY_SERVER} app:proxy-server account_autocreate true