Fix upload-swift-artifacts for old OSclient

If one has the old openstackclient, SWIFT_INTERNAL_URL
never gets set in upload-swift-artifacts because
'grep internal' fails in the initial attempt pipeline
and the script immediately exits at that point.

Modify the initial attempt to set SWIFT_INTERNAL_URL to
return success even if the pipeline of commands has an
error.

Change-Id: I0cdb3be1d8e984e271cc940be053117ae503ca81
Closes-bug: 1628065
This commit is contained in:
Tom Barron 2016-09-26 15:01:47 -04:00
parent 3dcdb19253
commit 36b31c17f1

View File

@ -95,7 +95,7 @@ swift post "$CONTAINER_NAME"
SWIFT_ACCOUNT=$(swift stat "$CONTAINER_NAME" 2>/dev/null | grep Account: | sed -e "s|.*Account..||") SWIFT_ACCOUNT=$(swift stat "$CONTAINER_NAME" 2>/dev/null | grep Account: | sed -e "s|.*Account..||")
# This works with newer openstackclient which displays the endpoints in list # 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|") SWIFT_INTERNAL_URL=$(openstack endpoint list | grep swift | grep internal | sed -e "s|.*\(http.*\)://\([^/]*\)/.*|\1://\2|" || true)
if [ -z "$SWIFT_INTERNAL_URL" ]; then if [ -z "$SWIFT_INTERNAL_URL" ]; then
# fallback to old openstack client 'show' which displays all the URLs # fallback to old openstack client 'show' which displays all the URLs