Skip to content

Instantly share code, notes, and snippets.

@jfwood
Created January 3, 2014 16:19
Show Gist options
  • Save jfwood/8240709 to your computer and use it in GitHub Desktop.
Save jfwood/8240709 to your computer and use it in GitHub Desktop.
Script I'm using to play with image service. Line #35 is the import call I'm making, and #38 is where I see the status is failed: {"status": "failure", "created_at": "2014-01-03T02:50:53Z", "updated_at": "2014-01-03T02:50:55Z", "expires_at": "2014-01-05T02:50:55Z", "id": "76827874-e5b7-4998-b0f7-a028d3560234", "owner": "802958", "input": {"image…
#!/bin/sh
# Create tar file per Rackspace configs:
TAR_FILE=gs-intern-deb-rackspace-configs.tar.gz
VHD_FILE=be8d2659-a995-42a4-a270-b08e4c7986f1.vhd
OVF_FILE=gs-intern-deb-rackspace-configs.ovf
#tar czvf $TAR_FILE $VHD_FILE $OVF_FILE
# Use this to get the API token:
# curl -X POST -d @auth.xml -H "Content-Type: application/xml" -H "Accept: application/xml" https://auth.api.rackspacecloud.com/v1.1/auth
AUTH_TOKEN=<token here>
IS_END=https://iad.images.api.rackspacecloud.com/v2/802958
CF_END=https://storage101.iad3.clouddrive.com/v1/MossoCloudFS_a1d4e46d-4091-49f4-a532-7ce73823623b
CONTAINER=test_images
TENANT_ID=802958
# Get a list of images currently.
#curl -H "X-Auth-Token: $AUTH_TOKEN" $IS_END/images
# Get info on limits.
#curl -H "X-Auth-Token: $AUTH_TOKEN" $IS_END/limits
# Upload OVA file to Cloud Files.
IMAGE_FILE_SRC=/Users/john.wood/projects/security/gs/$TAR_FILE
IMAGE_FILE_DST=$TAR_FILE
# - Create a test container:
#curl -X PUT -H "X-Auth-Token: $AUTH_TOKEN" $CF_END/$CONTAINER
# - Upload file to the container:
#curl -v -X PUT -H "X-Auth-Token: $AUTH_TOKEN" -T $IMAGE_FILE_SRC $CF_END/$CONTAINER/$IMAGE_FILE_DST
# Import OVA file.
#curl -s -k $IS_END/tasks -X POST -H "X-Auth-Project-Id: $TENANT_ID" -H "Accept: application/json" -H "Content-Type: application/json" -H "X-Tenant-Id: $TENANT_ID" -H "X-User-Id: $TENANT_ID" -H "X-Auth-Token: $AUTH_TOKEN" -d '{"type": "import", "input": {"import_from": "test_images/gs-intern-deb-rackspace-configs.tar.gz", "import_from_format": "vhd", "image_properties" : {"name": "GS Debian 7.2 v1.0.0", "org.openstack__1__os_distro": "org.debian", "org.openstack__1__architecture": "x64", "org.openstack__1__os_version": "7.2"}}}'
IMAGE_ID=76827874-e5b7-4998-b0f7-a028d3560234
# Check progress.
curl -s -k $IS_END/tasks/$IMAGE_ID -X GET -H "X-Auth-Project-Id: $TENANT_ID" -H "Accept: application/json" -H "Content-Type: application/json" -H "X-Tenant-Id: $TENANT_ID" -H "X-User-Id: $TENANT_ID" -H "X-Auth-Token: $AUTH_TOKEN"
@jfwood
Copy link
Author

jfwood commented Jan 3, 2014

curl -i -v -s -k https://iad.images.api.rackspacecloud.com/v2/802958/tasks -X POST -H 'X-Auth-Project-Id: 802958' -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'X-Tenant-Id: 802958' -H 'X-User-Id: 802958' -H 'X-Auth-Token: ' -d '{"type": "import", "input": {"import_from": "test_images/gs-intern-deb-rackspace-configs.tar.gz", "import_from_format": "vhd", "image_properties" : {"name": "GS Debian 7.2 v1.0.0", "org.openstack__1__os_distro": "org.debian", "org.openstack__1__architecture": "x64", "org.openstack__1__os_version": "7.2"}}}'

Curl output:

  • About to connect() to iad.images.api.rackspacecloud.com port 443 (#0)
  • Trying 69.20.65.142...
  • connected
  • Connected to iad.images.api.rackspacecloud.com (69.20.65.142) port 443 (#0)
  • SSLv3, TLS handshake, Client hello (1):
  • SSLv3, TLS handshake, Server hello (2):
  • SSLv3, TLS handshake, CERT (11):
  • SSLv3, TLS handshake, Server finished (14):
  • SSLv3, TLS handshake, Client key exchange (16):
  • SSLv3, TLS change cipher, Client hello (1):
  • SSLv3, TLS handshake, Finished (20):
  • SSLv3, TLS change cipher, Client hello (1):
  • SSLv3, TLS handshake, Finished (20):
  • SSL connection using RC4-SHA
  • Server certificate:
  • subject: OU=Go to https://www.thawte.com/repository/index.html; OU=Thawte SSL123 certificate; OU=Domain Validated; CN=iad.images.api.rackspacecloud.com
  • start date: 2013-10-07 00:00:00 GMT
  • expire date: 2015-10-07 23:59:59 GMT
  • subjectAltName: iad.images.api.rackspacecloud.com matched
  • issuer: C=US; O=Thawte, Inc.; OU=Domain Validated SSL; CN=Thawte DV SSL CA
  • SSL certificate verify ok.

POST /v2/802958/tasks HTTP/1.1
User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8y zlib/1.2.5
Host: iad.images.api.rackspacecloud.com
X-Auth-Project-Id: 802958
Accept: application/json
Content-Type: application/json
X-Tenant-Id: 802958
X-User-Id: 802958
X-Auth-Token: 2c92582507ae413b9eb1f87b8858df35
Content-Length: 307

  • upload completely sent off: 307 out of 307 bytes
    < HTTP/1.1 201 Created
    HTTP/1.1 201 Created
    < Content-Type: application/json; charset=UTF-8
    Content-Type: application/json; charset=UTF-8
    < Via: 1.1 Repose (Repose/2.12)
    Via: 1.1 Repose (Repose/2.12)
    < Content-Length: 594
    Content-Length: 594
    < Date: Fri, 03 Jan 2014 16:33:57 GMT
    Date: Fri, 03 Jan 2014 16:33:57 GMT
    < x-openstack-request-id: req-a2cc7af5-4b0c-4a45-a8b1-2404654ddef8
    x-openstack-request-id: req-a2cc7af5-4b0c-4a45-a8b1-2404654ddef8
    < Server: Jetty(8.0.y.z-SNAPSHOT)
    Server: Jetty(8.0.y.z-SNAPSHOT)

<

  • Connection #0 to host iad.images.api.rackspacecloud.com left intact
    {"status": "pending", "created_at": "2014-01-03T16:33:57Z", "updated_at": "2014-01-03T16:33:57Z", "expires_at": "2014-01-03T16:33:57Z", "id": "ff262ef4-49ac-41e3-b333-630c13f1df52", "owner": "802958", "input": {"image_properties": {"org.openstack__1__os_version": "7.2", "org.openstack__1__os_distro": "org.debian", "name": "GS Debian 7.2 v1.0.0", "org.openstack__1__architecture": "x64"}, "import_from_format": "vhd", "import_from": "test_images/gs-intern-deb-rackspace-configs.tar.gz"}, "type": "import", "self": "/v2/tasks/ff262ef4-49ac-41e3-b333-630c13f1df52", "schema": "/v2/schemas/task"}* Closing connection #0
  • SSLv3, TLS alert, Client hello (1):

@jfwood
Copy link
Author

jfwood commented Jan 3, 2014

curl -i -v -s -k https://iad.images.api.rackspacecloud.com/v2/802958/tasks/76827874-e5b7-4998-b0f7-a028d3560234 -X GET -H 'X-Auth-Project-Id: 802958' -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'X-Tenant-Id: 802958' -H 'X-User-Id: 802958' -H 'X-Auth-Token: '

@jfwood
Copy link
Author

jfwood commented Jan 3, 2014

response to the status check above:

  • About to connect() to iad.images.api.rackspacecloud.com port 443 (#0)
  • Trying 69.20.65.142...
  • connected
  • Connected to iad.images.api.rackspacecloud.com (69.20.65.142) port 443 (#0)
  • SSLv3, TLS handshake, Client hello (1):
  • SSLv3, TLS handshake, Server hello (2):
  • SSLv3, TLS handshake, CERT (11):
  • SSLv3, TLS handshake, Server finished (14):
  • SSLv3, TLS handshake, Client key exchange (16):
  • SSLv3, TLS change cipher, Client hello (1):
  • SSLv3, TLS handshake, Finished (20):
  • SSLv3, TLS change cipher, Client hello (1):
  • SSLv3, TLS handshake, Finished (20):
  • SSL connection using RC4-SHA
  • Server certificate:
  • subject: OU=Go to https://www.thawte.com/repository/index.html; OU=Thawte SSL123 certificate; OU=Domain Validated; CN=iad.images.api.rackspacecloud.com
  • start date: 2013-10-07 00:00:00 GMT
  • expire date: 2015-10-07 23:59:59 GMT
  • subjectAltName: iad.images.api.rackspacecloud.com matched
  • issuer: C=US; O=Thawte, Inc.; OU=Domain Validated SSL; CN=Thawte DV SSL CA
  • SSL certificate verify ok.

GET /v2/802958/tasks/76827874-e5b7-4998-b0f7-a028d3560234 HTTP/1.1
User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8y zlib/1.2.5
Host: iad.images.api.rackspacecloud.com
X-Auth-Project-Id: 802958
Accept: application/json
Content-Type: application/json
X-Tenant-Id: 802958
X-User-Id: 802958
X-Auth-Token: 2c92582507ae413b9eb1f87b8858df35

< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Content-Type: application/json; charset=UTF-8
Content-Type: application/json; charset=UTF-8
< Via: 1.1 Repose (Repose/2.12)
Via: 1.1 Repose (Repose/2.12)
< Content-Length: 797
Content-Length: 797
< Date: Fri, 03 Jan 2014 16:35:49 GMT
Date: Fri, 03 Jan 2014 16:35:49 GMT
< x-openstack-request-id: req-d88b7980-e9b0-4e11-8310-e776bb923ce3
x-openstack-request-id: req-d88b7980-e9b0-4e11-8310-e776bb923ce3
< Server: Jetty(8.0.y.z-SNAPSHOT)
Server: Jetty(8.0.y.z-SNAPSHOT)

<

  • Connection #0 to host iad.images.api.rackspacecloud.com left intact
    {"status": "failure", "created_at": "2014-01-03T02:50:53Z", "updated_at": "2014-01-03T02:50:55Z", "expires_at": "2014-01-05T02:50:55Z", "id": "76827874-e5b7-4998-b0f7-a028d3560234", "owner": "802958", "input": {"image_properties": {"org.openstack__1__os_version": "7.2", "org.openstack__1__os_distro": "org.debian", "name": "GS Debian 7.2 v1.0.0", "org.openstack__1__architecture": "x64"}, "import_from_format": "vhd", "import_from": "/Users/john.wood/projects/security/gs/gs-intern-deb-rackspace-configs.tar.gz"}, "message": "Error: Object GET failed: https://storage101.iad3.clouddrive.com:443/v1/MossoCloudFS_a1d4e46d-4091-49f4-a532-7ce73823623b//Users 412 Precondition Failed Bad URL", "type": "import", "self": "/v2/tasks/76827874-e5b7-4998-b0f7-a028d3560234", "schema": "/v2/schemas/task"}* Closing connection #0
  • SSLv3, TLS alert, Client hello (1):

@jfwood
Copy link
Author

jfwood commented Jan 3, 2014

t: application/json' -H 'Content-Type: application/json' -H 'X-Tenant-Id: 802958' -H 'X-User-Id: 802958' -H 'X-Auth-Token: 2c92582507ae413b9eb1f87b8858df35'802958' -H 'Accep

  • About to connect() to iad.images.api.rackspacecloud.com port 443 (#0)
  • Trying 69.20.65.142...
  • connected
  • Connected to iad.images.api.rackspacecloud.com (69.20.65.142) port 443 (#0)
  • SSLv3, TLS handshake, Client hello (1):
  • SSLv3, TLS handshake, Server hello (2):
  • SSLv3, TLS handshake, CERT (11):
  • SSLv3, TLS handshake, Server finished (14):
  • SSLv3, TLS handshake, Client key exchange (16):
  • SSLv3, TLS change cipher, Client hello (1):
  • SSLv3, TLS handshake, Finished (20):
  • SSLv3, TLS change cipher, Client hello (1):
  • SSLv3, TLS handshake, Finished (20):
  • SSL connection using RC4-SHA
  • Server certificate:
  • subject: OU=Go to https://www.thawte.com/repository/index.html; OU=Thawte SSL123 certificate; OU=Domain Validated; CN=iad.images.api.rackspacecloud.com
  • start date: 2013-10-07 00:00:00 GMT
  • expire date: 2015-10-07 23:59:59 GMT
  • subjectAltName: iad.images.api.rackspacecloud.com matched
  • issuer: C=US; O=Thawte, Inc.; OU=Domain Validated SSL; CN=Thawte DV SSL CA
  • SSL certificate verify ok.

GET /v2/802958/tasks/ff262ef4-49ac-41e3-b333-630c13f1df52 HTTP/1.1
User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8y zlib/1.2.5
Host: iad.images.api.rackspacecloud.com
X-Auth-Project-Id: 802958
Accept: application/json
Content-Type: application/json
X-Tenant-Id: 802958
X-User-Id: 802958
X-Auth-Token: 2c92582507ae413b9eb1f87b8858df35

< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Content-Type: application/json; charset=UTF-8
Content-Type: application/json; charset=UTF-8
< Via: 1.1 Repose (Repose/2.12)
Via: 1.1 Repose (Repose/2.12)
< Content-Length: 908
Content-Length: 908
< Date: Fri, 03 Jan 2014 16:54:24 GMT
Date: Fri, 03 Jan 2014 16:54:24 GMT
< x-openstack-request-id: req-385ad932-aff9-43f0-8559-b01f43c7f63c
x-openstack-request-id: req-385ad932-aff9-43f0-8559-b01f43c7f63c
< Server: Jetty(8.0.y.z-SNAPSHOT)
Server: Jetty(8.0.y.z-SNAPSHOT)

<

  • Connection #0 to host iad.images.api.rackspacecloud.com left intact
    {"status": "success", "created_at": "2014-01-03T16:33:57Z", "updated_at": "2014-01-03T16:36:00Z", "expires_at": "2014-01-05T16:36:00Z", "id": "ff262ef4-49ac-41e3-b333-630c13f1df52", "result": {"image_id": "0a3db9c9-d3f8-42f8-b08a-0b9927ca5895"}, "owner": "802958", "input": {"image_properties": {"com.rackspace__1__visible_core": "1", "com.rackspace__1__build_rackconnect": "1", "com.rackspace__1__options": "0", "org.openstack__1__os_version": "7.2", "com.rackspace__1__visible_rackconnect": "1", "org.openstack__1__os_distro": "org.debian", "com.rackspace__1__build_managed": "1", "com.rackspace__1__build_core": "1", "com.rackspace__1__visible_managed": "1", "org.openstack__1__architecture": "x64"}, "import_from_format": "vhd", "import_from": "test_images/gs-intern-deb-rackspace-configs.tar.gz"}, "type": "import", "self": "/v2/tasks/ff262ef4-49ac-41e3-b333-630c13f1df52", "schema": "/v2/schemas/task"}* Closing connection #0
  • SSLv3, TLS alert, Client hello (1):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment