Use jq to create manifest. Upload to compute_images

This commit is contained in:
Matthew Hooker 2018-10-17 20:48:50 -07:00
parent 96e62236ec
commit 8207ba4fa4
No known key found for this signature in database
GPG Key ID: 7B5F933D9CE8C6A1
1 changed files with 12 additions and 12 deletions

View File

@ -43,19 +43,19 @@ for i in segment_*; do
${STORAGE_URL}/mwhooker-test-1/$i; ${STORAGE_URL}/mwhooker-test-1/$i;
done done
( curl -OL https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64
echo [ mv jq-linux64 jq
for i in segment_*; do chmod u+x jq
printf '{"path": "%s", "etag": "%s", "size_bytes": %s},\n' "mwhooker-test-1/$i" $(md5sum $i | cut -f1 -d' ') $(stat --printf "%s" $i)
done
echo ]
) > manifest.json
curl --connect-timeout 5 \ (
--max-time 3600 \ for i in segment_*; do
--retry 5 \ ./jq -n --arg path "mwhooker-test-1/$i" --arg etag $(md5sum $i | cut -f1 -d' ') --arg size_bytes $(stat --printf "%s" $i) '{path: $path, etag: $etag, size_bytes: $size_bytes}'
--retry-delay 0 \ done
-o {{ .DiskImagePath }} \ ) | ./jq -s . > manifest.json
curl -v -X PUT -H "X-Auth-Token: $AUTH_TOKEN" "${STORAGE_URL}/compute_images/mwhooker-diskimage-01.tar.gz?multipart-manifest=put" -T ./manifest.json
# curl -I -X HEAD -H "X-Auth-Token: $AUTH_TOKEN" "${STORAGE_URL}/mwhooker-test-1/diskimage.tar.gz"
'...'` '...'`
} }
/* /*