Fix upload-swift-artifacts handling of json data
The upload-swift-artifacts script needs to handle json encoding of
the Temp-Url-Key property, and [1] was a step in the right direction.
However, it contained two errors that this patch corrects:
1. The property name is "Temp-Url-Key" (camel-case). Even if you specify
"Temp-URL-Key" something will change "URL" to "Url". This patch uses
the correct form when detecting whether the property exists.
2. The logic for detecting whether the Temp-Url-Key property exists was
inverted. The property doesn't exist when the jq output is "null".
[1] Ife347f754ca9129580c092bb271bacdc032ae14b
Closes-Bug: #1867135
Change-Id: Idf0dccf4cd7d040e803b2ed2b49b3c39919c5a60
(cherry picked from commit 29367cb96d
)
This commit is contained in:
parent
d2e9011fd2
commit
81d9792c3d
|
@ -129,11 +129,11 @@ fi
|
|||
# Does the Temp-URL-Key exist on this container?
|
||||
# jq will output "null" if it doesn't
|
||||
# If not set it...
|
||||
SWIFT_TEMP_URL_KEY=$(openstack container show $CONTAINER_NAME -f json 2>/dev/null | jq -r '.properties."Temp-URL-Key"' || true)
|
||||
if [ "$SWIFT_TEMP_URL_KEY" != "null" ]; then
|
||||
echo "Creating new Swift Temp-URL-Key for container: $CONTAINER_NAME"
|
||||
SWIFT_TEMP_URL_KEY=$(openstack container show $CONTAINER_NAME -f json 2>/dev/null | jq -r '.properties."Temp-Url-Key"' || true)
|
||||
if [ "$SWIFT_TEMP_URL_KEY" == "null" ]; then
|
||||
echo "Creating new Swift Temp-Url-Key for container: $CONTAINER_NAME"
|
||||
SWIFT_TEMP_URL_KEY=$(uuidgen | sha1sum | awk '{print $1}')
|
||||
openstack container set --property "Temp-URL-Key=$SWIFT_TEMP_URL_KEY" "${CONTAINER_NAME}"
|
||||
openstack container set --property "Temp-Url-Key=$SWIFT_TEMP_URL_KEY" "${CONTAINER_NAME}"
|
||||
fi
|
||||
|
||||
if [ -n "${ENVIRONMENT_FILE:-}" ]; then
|
||||
|
|
Loading…
Reference in New Issue