Fix upload-swift-artifacts work new OSclient

This resolves a regression in 7d41589d59
where we again broke this shell script with newer version of
openstackclient. In that commit we added an
'openstack endpoint show swift' which again causes errors with
the latest openstackclient.

This patch reverses the logic so that we try to calculate the
swift internal URL with the new command first. This won't error
on the old version of openstackclient so everything should be happy
I think.

Change-Id: If46687dfb0f2ad2a116eae41422ea160f61026cd
Closes-bug: #1618488
This commit is contained in:
Dan Prince 2016-08-30 10:31:06 -04:00
parent 6f2d71ef74
commit 960dd971f1
1 changed files with 4 additions and 2 deletions

View File

@ -94,10 +94,12 @@ swift post "$CONTAINER_NAME"
SWIFT_ACCOUNT=$(swift stat "$CONTAINER_NAME" 2>/dev/null | grep Account: | sed -e "s|.*Account..||")
SWIFT_INTERNAL_URL=$(openstack endpoint show swift | grep internalurl | sed -e "s|.*\(http.*\)://\([^/]*\)/.*|\1://\2|")
# This works with newer openstackclient which displays the endpoints in list
SWIFT_INTERNAL_URL=$(openstack endpoint list | grep swift | grep internal | sed -e "s|.*\(http.*\)://\([^/]*\)/.*|\1://\2|")
if [ -z "$SWIFT_INTERNAL_URL" ]; then
SWIFT_INTERNAL_URL=$(openstack endpoint list | grep swift | grep internal | sed -e "s|.*\(http.*\)://\([^/]*\)/.*|\1://\2|")
# fallback to old openstack client 'show' which displays all the URLs
SWIFT_INTERNAL_URL=$(openstack endpoint show swift | grep internalurl | sed -e "s|.*\(http.*\)://\([^/]*\)/.*|\1://\2|")
fi
# Does the Temp-URL-Key exist on this container?