#!/bin/bash
set -e
source ${ENV_FILE}
# set image name
IMAGE_DEF=
# set url
URL=
# file path
FILE_PATH=
# get token
TOKEN=`openstack token issue -f value -c id --insecure`
# create stub
IMAGE_ID=`curl -XPOST -H 'content-type: application/json' -H 'x-auth-token: ${TOKEN}' -d @${IMAGE_DEF} ${URL}/v2/images --insecure | jq '.id' | sed 's/\"//'`
# upload file to stub
curl -XPUT -H 'content-type: application/octet-stream' -H 'x-auth-token: ${TOKEN}' -d @${FILE_PATH} ${URL}/v2/images/${IMAGE_ID}/file --insecure
Last active
October 29, 2018 00:18
-
-
Save jshen28/0b9c3440860420438975c65a752ee941 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment