diff --git a/lib/swift b/lib/swift index 84304d34d6..d8e8f23edf 100644 --- a/lib/swift +++ b/lib/swift @@ -115,6 +115,10 @@ OBJECT_PORT_BASE=${OBJECT_PORT_BASE:-6013} CONTAINER_PORT_BASE=${CONTAINER_PORT_BASE:-6011} ACCOUNT_PORT_BASE=${ACCOUNT_PORT_BASE:-6012} +# Enable tempurl feature +SWIFT_ENABLE_TEMPURLS=${SWIFT_ENABLE_TEMPURLS:-False} +SWIFT_TEMPURL_KEY=${SWIFT_TEMPURL_KEY} + # Tell Tempest this project is present TEMPEST_SERVICES+=,swift @@ -679,6 +683,10 @@ function start_swift { screen_it s-${type} "cd $SWIFT_DIR && $SWIFT_DIR/bin/swift-${type}-server ${SWIFT_CONF_DIR}/${type}-server/1.conf -v" done fi + + if [[ "$SWIFT_ENABLE_TEMPURLS" == "True" ]]; then + swift_configure_tempurls + fi } # stop_swift() - Stop running processes (non-screen) @@ -701,6 +709,13 @@ function stop_swift { pkill -f swift- } +function swift_configure_tempurls { + OS_USERNAME=swift \ + OS_TENANT_NAME=$SERVICE_TENANT_NAME \ + OS_PASSWORD=$SERVICE_PASSWORD \ + swift post -m "Temp-URL-Key: $SWIFT_TEMPURL_KEY" +} + # Restore xtrace $XTRACE diff --git a/stack.sh b/stack.sh index 03ecf2832f..3e8f7e98b5 100755 --- a/stack.sh +++ b/stack.sh @@ -472,6 +472,10 @@ if is_service_enabled s-proxy; then # ``SWIFT_HASH`` is a random unique string for a swift cluster that # can never change. read_password SWIFT_HASH "ENTER A RANDOM SWIFT HASH." + + if [[ -z "$SWIFT_TEMPURL_KEY" ]] && [[ "$SWIFT_ENABLE_TEMPURLS" == "True" ]]; then + read_password SWIFT_TEMPURL_KEY "ENTER A KEY FOR SWIFT TEMPURLS." + fi fi