diff options
author | Robin Appelman <robin@icewind.nl> | 2018-02-13 15:44:55 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2018-02-19 19:41:16 +0100 |
commit | 2a9b3b31aa122608972b01d8a2f0c43c3491ce0a (patch) | |
tree | 5d2d13e754d0edfba9d8a5cac5a01a0202f081c9 /tests/drone-wait-objectstore.sh | |
parent | a80f72c6c8a89eb77a13cfba3e4fc27e95572824 (diff) | |
download | nextcloud-server-2a9b3b31aa122608972b01d8a2f0c43c3491ce0a.tar.gz nextcloud-server-2a9b3b31aa122608972b01d8a2f0c43c3491ce0a.zip |
use more precise method for waiting for swift
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'tests/drone-wait-objectstore.sh')
-rwxr-xr-x | tests/drone-wait-objectstore.sh | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/tests/drone-wait-objectstore.sh b/tests/drone-wait-objectstore.sh index 14d0b6f1f67..f1d9faad7ab 100755 --- a/tests/drone-wait-objectstore.sh +++ b/tests/drone-wait-objectstore.sh @@ -1,10 +1,36 @@ #!/bin/bash +function get_swift_token() { + KEYSTONE_OUT=$(curl -s 'http://dockswift:5000/v2.0/tokens' -H 'Content-Type: application/json' -d '{"auth":{"passwordCredentials":{"username":"swift","password":"swift"},"tenantName":"service"}}') + if (echo "$KEYSTONE_OUT" | grep -q 'object-store') + then + SWIFT_ENDPOINT=$(echo "$KEYSTONE_OUT" | php -r "echo array_values(array_filter(json_decode(file_get_contents('php://stdin'),true)['access']['serviceCatalog'], function(\$endpoint){return \$endpoint['type']==='object-store';}))[0]['endpoints'][0]['publicURL'];") + SWIFT_TOKEN=$(echo "$KEYSTONE_OUT" | php -r "echo json_decode(file_get_contents('php://stdin'),true)['access']['token']['id'];") + return 0 + else + return -1 + fi +} + if [ "$OBJECT_STORE" == "swift" ]; then - echo "waiting for swift" - until curl -I http://dockswift:5000/v3 + echo "waiting for keystone" + until get_swift_token + do + sleep 2 + done + + echo "waiting for object store at $SWIFT_ENDPOINT" + + until curl -s -H "X-Auth-Token: $SWIFT_TOKEN" "$SWIFT_ENDPOINT" do sleep 2 done - sleep 60 + + echo "creating container" + + sleep 2 + + curl curl -s -X PUT -H "X-Auth-Token: $SWIFT_TOKEN" "$SWIFT_ENDPOINT/nextcloud" + + sleep 2 fi |