Skip to content

Instantly share code, notes, and snippets.

@tr3buchet
Created April 19, 2011 20:10
Show Gist options
  • Save tr3buchet/929496 to your computer and use it in GitHub Desktop.
Save tr3buchet/929496 to your computer and use it in GitHub Desktop.
example of curling against the openstack api
(trey|n3va)~/nova> cat novarc
NOVA_KEY_DIR=$(pushd $(dirname $BASH_SOURCE)>/dev/null; pwd; popd>/dev/null)
export EC2_ACCESS_KEY="admin:openstack"
export EC2_SECRET_KEY="5a7fc8fe-4029-4046-82fc-b8b45a5ef0e8"
export EC2_URL="http://10.127.4.150:8773/services/Cloud"
export S3_URL="http://10.127.4.150:3333"
export EC2_USER_ID=42 # nova does not use user id, but bundling requires it
export EC2_PRIVATE_KEY=${NOVA_KEY_DIR}/pk.pem
export EC2_CERT=${NOVA_KEY_DIR}/cert.pem
export NOVA_CERT=${NOVA_KEY_DIR}/cacert.pem
export EUCALYPTUS_CERT=${NOVA_CERT} # euca-bundle-image seems to require this set
alias ec2-bundle-image="ec2-bundle-image --cert ${EC2_CERT} --privatekey ${EC2_PRIVATE_KEY} --user 42 --ec2cert ${NOVA_CERT}"
alias ec2-upload-bundle="ec2-upload-bundle -a ${EC2_ACCESS_KEY} -s ${EC2_SECRET_KEY} --url ${S3_URL} --ec2cert ${NOVA_CERT}"
export NOVA_API_KEY="admin"
export NOVA_USERNAME="admin"
export NOVA_URL="http://10.127.4.150:8774/v1.0/"
(trey|n3va)~/nova>
(trey|n3va)~/nova> curl -ik -H 'X-Auth-User: admin' -H 'X-Auth-Key: admin' http://127.0.0.1:8774/v1.0/
HTTP/1.1 204 No Content
Content-Length: 0
X-Auth-Token: b36db315100968305df2ee5d6e49e0a85be8ad15
X-Server-Management-Url: http://127.0.0.1:8774/v1.0/
X-Storage-Url:
X-Cdn-Management-Url:
Content-Type: text/plain; charset=UTF-8
Date: Tue, 19 Apr 2011 18:56:42 GMT
(trey|n3va)~/nova>
(trey|n3va)~/nova> curl -ik -H 'X-Auth-Token: b36db315100968305df2ee5d6e49e0a85be8ad15' http://127.0.0.1:8774/v1.0/servers/1
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 238
Date: Tue, 19 Apr 2011 18:57:07 GMT
{"server": {"status": "ACTIVE", "hostId": "3ab5b1023ba8417425cb13d54d5187643b28fafaa285a181471188e0", "addresses": {"public": [], "private": ["10.1.0.2", "10.2.0.2"]}, "name": "t1", "flavorId": 1, "imageId": "7", "id": 1, "metadata": {}}}
(trey|n3va)~/nova>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment