zerovm / zpm

ZeroVM Package Manager
Apache License 2.0
6 stars 11 forks source link

"zpm deploy -l debug" should include request/response data #131

Closed etoews closed 10 years ago

etoews commented 10 years ago

When running zpm deploy -l debug I only see:

INFO:deploying hello.zapp
INFO:updated mycontainer/hello.zapp succesfully
INFO:updated mycontainer/hello.json succesfully
INFO:updated mycontainer/index.html succesfully
INFO:updated mycontainer/style.css succesfully
INFO:updated mycontainer/zerocloud.js succesfully
INFO:app deployed to
https://zebra.zerovm.org/v1/AUTH_xxx/mycontainer/

If it contained the full request/response data ala nova --debug, that would be a huge help to creating clients for ZeroVM.

Also, it's weird that there aren't any debug level messages in the above.

larsbutler commented 10 years ago

Hey @everett-toews,

I agree, having the request response data shown at DEBUG would be useful.

The reason why there are no debug messages displayed is because at present there simply aren't any debug level messages in this code path. (It seems there are only debug messages when an app is executed, using zpm execute or zpm deploy --execute.)

larsbutler commented 10 years ago

@everett-toews Patch submitted; is this what you're looking for?

etoews commented 10 years ago

@larsbutler Probably?

Can you paste in some sample output please?

larsbutler commented 10 years ago

@everett-toews Sure. Here are a few examples. Auth tokens and and AUTH_ URLs replaced with fake ones. Since we're using python-swiftclient to handle all of our requests, having this output was simply a matter of configuring the logging properly.

Deploy, no execute, INFO:

$ zpm deploy -l info test1 hello.zapp
INFO:zpmlib.commands: deploying hello.zapp
INFO:swiftclient: REQ: curl -i https://zebra.zerovm.org/v1/AUTH_ABC123/test1?format=json -X GET -H "X-Auth-Token: AUTH_tkABC123"
INFO:swiftclient: RESP STATUS: 404 Not Found
INFO:swiftclient: RESP HEADERS: [('date', 'Mon, 04 Aug 2014 09:43:17 GMT'), ('content-length', '70'), ('content-type', 'text/html; charset=UTF-8'), ('x-trans-id', 'tx3a9c83f79a5b41e59dad9-0053df55b5')]
INFO:swiftclient: RESP BODY: <html><h1>Not Found</h1><p>The resource could not be found.</p></html>
INFO:zpmlib.zpm: Container 'test1' not found. Creating it...
app deployed to
  https://zebra.zerovm.org/v1/AUTH_ABC123/test1/index.html

Deploy, no execute, DEBUG:

$ zpm deploy -l debug test2 hello.zapp
INFO:zpmlib.commands: deploying hello.zapp
DEBUG:swiftclient: REQ: curl -i https://zebra.zerovm.org/auth/v1.0 -X GET
DEBUG:swiftclient: RESP STATUS: 200 OK
DEBUG:swiftclient: RESP HEADERS: [('content-length', '115'), ('set-cookie', 'session=AUTH_tkABC123; Domain=zebra.zerovm.org; expires=Tue, 05 Aug 2014 09:41:56 GMT; httponly; Path=/; secure, storage=https%3A%2F%2Fzebra.zerovm.org%2Fv1%2FAUTH_ABC123; Domain=zebra.zerovm.org; expires=Tue, 05 Aug 2014 09:41:56 GMT; Path=/; secure'), ('x-trans-id', 'txc65afb1dfeae4465bca74-0053df55ce'), ('x-auth-token-expires', '86294'), ('x-auth-token', 'AUTH_tkABC123'), ('x-storage-token', 'AUTH_tkABC123'), ('date', 'Mon, 04 Aug 2014 09:43:42 GMT'), ('x-storage-url', 'https://zebra.zerovm.org/v1/AUTH_ABC123'), ('content-type', 'text/html; charset=UTF-8')]
DEBUG:swiftclient: RESP BODY: {"storage": {"default": "local", "local": "https://zebra.zerovm.org/v1/AUTH_ABC123"}}
INFO:swiftclient: REQ: curl -i https://zebra.zerovm.org/v1/AUTH_ABC123/test2?format=json -X GET -H "X-Auth-Token: AUTH_tkABC123"
INFO:swiftclient: RESP STATUS: 404 Not Found
INFO:swiftclient: RESP HEADERS: [('date', 'Mon, 04 Aug 2014 09:43:42 GMT'), ('content-length', '70'), ('content-type', 'text/html; charset=UTF-8'), ('x-trans-id', 'tx252d64868fcc4f4a9668c-0053df55ce')]
INFO:swiftclient: RESP BODY: <html><h1>Not Found</h1><p>The resource could not be found.</p></html>
INFO:zpmlib.zpm: Container 'test2' not found. Creating it...
DEBUG:swiftclient: REQ: curl -i https://zebra.zerovm.org/v1/AUTH_ABC123/test2 -X PUT -H "Content-Length: 0" -H "X-Auth-Token: AUTH_tkABC123"
DEBUG:swiftclient: RESP STATUS: 201 Created
DEBUG:swiftclient: RESP HEADERS: [('date', 'Mon, 04 Aug 2014 09:43:44 GMT'), ('content-length', '0'), ('content-type', 'text/html; charset=UTF-8'), ('x-trans-id', 'tx679793a460c54271a27f9-0053df55cf')]
DEBUG:swiftclient: REQ: curl -i https://zebra.zerovm.org/v1/AUTH_ABC123/test2/hello.zapp -X PUT -H "X-Auth-Token: AUTH_tkABC123"
DEBUG:swiftclient: RESP STATUS: 201 Created
DEBUG:swiftclient: RESP HEADERS: [('content-length', '0'), ('last-modified', 'Mon, 04 Aug 2014 09:43:46 GMT'), ('etag', '711669fa5f8a95d98916d3794975f065'), ('x-trans-id', 'tx64d7f1d0f0344b158fcba-0053df55d1'), ('date', 'Mon, 04 Aug 2014 09:43:45 GMT'), ('content-type', 'text/html; charset=UTF-8')]
DEBUG:swiftclient: REQ: curl -i https://zebra.zerovm.org/v1/AUTH_ABC123/test2/boot/system.map -X PUT -H "X-Auth-Token: AUTH_tkABC123"
DEBUG:swiftclient: RESP STATUS: 201 Created
DEBUG:swiftclient: RESP HEADERS: [('content-length', '0'), ('last-modified', 'Mon, 04 Aug 2014 09:43:47 GMT'), ('etag', 'f4b7438b8b3c9f75755667d2399b753b'), ('x-trans-id', 'tx77f7a96d1bd54e0ab37b8-0053df55d2'), ('date', 'Mon, 04 Aug 2014 09:43:46 GMT'), ('content-type', 'text/html; charset=UTF-8')]
DEBUG:swiftclient: REQ: curl -i https://zebra.zerovm.org/v1/AUTH_ABC123/test2/index.html -X PUT -H "X-Auth-Token: AUTH_tkABC123"
DEBUG:swiftclient: RESP STATUS: 201 Created
DEBUG:swiftclient: RESP HEADERS: [('content-length', '0'), ('last-modified', 'Mon, 04 Aug 2014 09:43:47 GMT'), ('etag', '19a250cfe4b1993772d654a95a3c509b'), ('x-trans-id', 'tx983ddfe854d1401191f76-0053df55d2'), ('date', 'Mon, 04 Aug 2014 09:43:46 GMT'), ('content-type', 'text/html; charset=UTF-8')]
DEBUG:swiftclient: REQ: curl -i https://zebra.zerovm.org/v1/AUTH_ABC123/test2/style.css -X PUT -H "X-Auth-Token: AUTH_tkABC123"
DEBUG:swiftclient: RESP STATUS: 201 Created
DEBUG:swiftclient: RESP HEADERS: [('content-length', '0'), ('last-modified', 'Mon, 04 Aug 2014 09:43:48 GMT'), ('etag', '88bc79a1dff0fead7eef65ada1266db6'), ('x-trans-id', 'txffe21ecd50af47f38b4ad-0053df55d3'), ('date', 'Mon, 04 Aug 2014 09:43:47 GMT'), ('content-type', 'text/html; charset=UTF-8')]
DEBUG:swiftclient: REQ: curl -i https://zebra.zerovm.org/v1/AUTH_ABC123/test2/zerocloud.js -X PUT -H "X-Auth-Token: AUTH_tkABC123"
DEBUG:swiftclient: RESP STATUS: 201 Created
DEBUG:swiftclient: RESP HEADERS: [('content-length', '0'), ('last-modified', 'Mon, 04 Aug 2014 09:43:49 GMT'), ('etag', '873f7faa40c9934c77d304af155a4434'), ('x-trans-id', 'tx7a20bd8b15bf40d0942c1-0053df55d4'), ('date', 'Mon, 04 Aug 2014 09:43:48 GMT'), ('content-type', 'text/html; charset=UTF-8')]
app deployed to
  https://zebra.zerovm.org/v1/AUTH_ABC123/test2/index.html

Deploy + execute, INFO:

$ zpm deploy -l info test3 hello.zapp --execute
INFO:zpmlib.commands: deploying hello.zapp
INFO:swiftclient: REQ: curl -i https://zebra.zerovm.org/v1/AUTH_ABC123/test3?format=json -X GET -H "X-Auth-Token: AUTH_tkABC123"
INFO:swiftclient: RESP STATUS: 404 Not Found
INFO:swiftclient: RESP HEADERS: [('date', 'Mon, 04 Aug 2014 09:44:12 GMT'), ('content-length', '70'), ('content-type', 'text/html; charset=UTF-8'), ('x-trans-id', 'tx6d375ea4b0ca49ea8382c-0053df55ec')]
INFO:swiftclient: RESP BODY: <html><h1>Not Found</h1><p>The resource could not be found.</p></html>
INFO:zpmlib.zpm: Container 'test3' not found. Creating it...
hello from zerovm!

app deployed to
  https://zebra.zerovm.org/v1/AUTH_ABC123/test3/index.html

Deploy + execute, DEBUG:

$ zpm deploy -l debug test4 hello.zapp --execute
INFO:zpmlib.commands: deploying hello.zapp
DEBUG:swiftclient: REQ: curl -i https://zebra.zerovm.org/auth/v1.0 -X GET
DEBUG:swiftclient: RESP STATUS: 200 OK
DEBUG:swiftclient: RESP HEADERS: [('content-length', '115'), ('set-cookie', 'session=AUTH_tkABC123; Domain=zebra.zerovm.org; expires=Tue, 05 Aug 2014 09:41:56 GMT; httponly; Path=/; secure, storage=https%3A%2F%2Fzebra.zerovm.org%2Fv1%2FAUTH_ABC123; Domain=zebra.zerovm.org; expires=Tue, 05 Aug 2014 09:41:56 GMT; Path=/; secure'), ('x-trans-id', 'tx66b9f8a379134ca794da3-0053df5601'), ('x-auth-token-expires', '86243'), ('x-auth-token', 'AUTH_tkABC123'), ('x-storage-token', 'AUTH_tkABC123'), ('date', 'Mon, 04 Aug 2014 09:44:33 GMT'), ('x-storage-url', 'https://zebra.zerovm.org/v1/AUTH_ABC123'), ('content-type', 'text/html; charset=UTF-8')]
DEBUG:swiftclient: RESP BODY: {"storage": {"default": "local", "local": "https://zebra.zerovm.org/v1/AUTH_ABC123"}}
INFO:swiftclient: REQ: curl -i https://zebra.zerovm.org/v1/AUTH_ABC123/test4?format=json -X GET -H "X-Auth-Token: AUTH_tkABC123"
INFO:swiftclient: RESP STATUS: 404 Not Found
INFO:swiftclient: RESP HEADERS: [('date', 'Mon, 04 Aug 2014 09:44:34 GMT'), ('content-length', '70'), ('content-type', 'text/html; charset=UTF-8'), ('x-trans-id', 'tx39d11a06bb37495e8d466-0053df5602')]
INFO:swiftclient: RESP BODY: <html><h1>Not Found</h1><p>The resource could not be found.</p></html>
INFO:zpmlib.zpm: Container 'test4' not found. Creating it...
DEBUG:swiftclient: REQ: curl -i https://zebra.zerovm.org/v1/AUTH_ABC123/test4 -X PUT -H "Content-Length: 0" -H "X-Auth-Token: AUTH_tkABC123"
DEBUG:swiftclient: RESP STATUS: 201 Created
DEBUG:swiftclient: RESP HEADERS: [('date', 'Mon, 04 Aug 2014 09:44:34 GMT'), ('content-length', '0'), ('content-type', 'text/html; charset=UTF-8'), ('x-trans-id', 'tx2486703f36ad4f868ec52-0053df5602')]
DEBUG:swiftclient: REQ: curl -i https://zebra.zerovm.org/v1/AUTH_ABC123/test4/hello.zapp -X PUT -H "X-Auth-Token: AUTH_tkABC123"
DEBUG:swiftclient: RESP STATUS: 201 Created
DEBUG:swiftclient: RESP HEADERS: [('content-length', '0'), ('last-modified', 'Mon, 04 Aug 2014 09:44:36 GMT'), ('etag', '711669fa5f8a95d98916d3794975f065'), ('x-trans-id', 'tx12970a6129264d16bc4ab-0053df5603'), ('date', 'Mon, 04 Aug 2014 09:44:36 GMT'), ('content-type', 'text/html; charset=UTF-8')]
DEBUG:swiftclient: REQ: curl -i https://zebra.zerovm.org/v1/AUTH_ABC123/test4/boot/system.map -X PUT -H "X-Auth-Token: AUTH_tkABC123"
DEBUG:swiftclient: RESP STATUS: 201 Created
DEBUG:swiftclient: RESP HEADERS: [('content-length', '0'), ('last-modified', 'Mon, 04 Aug 2014 09:44:38 GMT'), ('etag', '9e12d717037c81dfd3ade2eb29b8ca4f'), ('x-trans-id', 'tx70e0661f697b4d348ba4e-0053df5605'), ('date', 'Mon, 04 Aug 2014 09:44:37 GMT'), ('content-type', 'text/html; charset=UTF-8')]
DEBUG:swiftclient: REQ: curl -i https://zebra.zerovm.org/v1/AUTH_ABC123/test4/index.html -X PUT -H "X-Auth-Token: AUTH_tkABC123"
DEBUG:swiftclient: RESP STATUS: 201 Created
DEBUG:swiftclient: RESP HEADERS: [('content-length', '0'), ('last-modified', 'Mon, 04 Aug 2014 09:44:38 GMT'), ('etag', '19a250cfe4b1993772d654a95a3c509b'), ('x-trans-id', 'txf3dbde8f085341d28dc50-0053df5605'), ('date', 'Mon, 04 Aug 2014 09:44:37 GMT'), ('content-type', 'text/html; charset=UTF-8')]
DEBUG:swiftclient: REQ: curl -i https://zebra.zerovm.org/v1/AUTH_ABC123/test4/style.css -X PUT -H "X-Auth-Token: AUTH_tkABC123"
DEBUG:swiftclient: RESP STATUS: 201 Created
DEBUG:swiftclient: RESP HEADERS: [('content-length', '0'), ('last-modified', 'Mon, 04 Aug 2014 09:44:39 GMT'), ('etag', '88bc79a1dff0fead7eef65ada1266db6'), ('x-trans-id', 'tx2711970c5dfa4f73b96e9-0053df5606'), ('date', 'Mon, 04 Aug 2014 09:44:38 GMT'), ('content-type', 'text/html; charset=UTF-8')]
DEBUG:swiftclient: REQ: curl -i https://zebra.zerovm.org/v1/AUTH_ABC123/test4/zerocloud.js -X PUT -H "X-Auth-Token: AUTH_tkABC123"
DEBUG:swiftclient: RESP STATUS: 201 Created
DEBUG:swiftclient: RESP HEADERS: [('content-length', '0'), ('last-modified', 'Mon, 04 Aug 2014 09:44:40 GMT'), ('etag', '873f7faa40c9934c77d304af155a4434'), ('x-trans-id', 'tx1ffbb7f3abb24aaab16fd-0053df5607'), ('date', 'Mon, 04 Aug 2014 09:44:39 GMT'), ('content-type', 'text/html; charset=UTF-8')]
DEBUG:swiftclient: REQ: curl -i https://zebra.zerovm.org/auth/v1.0 -X GET
DEBUG:swiftclient: RESP STATUS: 200 OK
DEBUG:swiftclient: RESP HEADERS: [('content-length', '115'), ('set-cookie', 'session=AUTH_tkABC123; Domain=zebra.zerovm.org; expires=Tue, 05 Aug 2014 09:41:56 GMT; httponly; Path=/; secure, storage=https%3A%2F%2Fzebra.zerovm.org%2Fv1%2FAUTH_ABC123; Domain=zebra.zerovm.org; expires=Tue, 05 Aug 2014 09:41:56 GMT; Path=/; secure'), ('x-trans-id', 'txe4778c4fc1994a6aa71cb-0053df5607'), ('x-auth-token-expires', '86237'), ('x-auth-token', 'AUTH_tkABC123'), ('x-storage-token', 'AUTH_tkABC123'), ('date', 'Mon, 04 Aug 2014 09:44:39 GMT'), ('x-storage-url', 'https://zebra.zerovm.org/v1/AUTH_ABC123'), ('content-type', 'text/html; charset=UTF-8')]
DEBUG:swiftclient: RESP BODY: {"storage": {"default": "local", "local": "https://zebra.zerovm.org/v1/AUTH_ABC123"}}
DEBUG:swiftclient: REQ: curl -i https://zebra.zerovm.org/v1/AUTH_ABC123/test4/boot/system.map -X GET -H "X-Auth-Token: AUTH_tkABC123"
DEBUG:swiftclient: RESP STATUS: 200 OK
DEBUG:swiftclient: RESP HEADERS: [('content-length', '245'), ('accept-ranges', 'bytes'), ('last-modified', 'Mon, 04 Aug 2014 09:44:38 GMT'), ('etag', '9e12d717037c81dfd3ade2eb29b8ca4f'), ('x-timestamp', '1407145477.08335'), ('x-trans-id', 'tx649f70cb8a4b4c479ceb5-0053df5608'), ('date', 'Mon, 04 Aug 2014 09:44:40 GMT'), ('content-type', 'application/json')]
DEBUG:swiftclient: REQ: curl -i https://zebra.zerovm.org/v1/AUTH_ABC123 -X POST -H "Content-Type: application/json" -H "X-Zerovm-Execute: 1.0" -H "X-Auth-Token: AUTH_tkABC123"
DEBUG:swiftclient: RESP STATUS: 200 OK
DEBUG:swiftclient: RESP HEADERS: [('x-nexe-retcode', '0'), ('x-nexe-system', 'hello'), ('x-nexe-cdr-line', '4.396, 4.390, 0.14 3.87 1025 75942868 2 19 0 0 0 0'), ('x-nexe-policy', 'Policy-0'), ('x-nexe-validation', '0'), ('content-length', '19'), ('x-nexe-etag', 'disabled'), ('etag', '035f4c7abe607d17359db1e3affd3f08'), ('x-trans-id', 'tx51a50fbe3dc0446c92ace-0053df5609'), ('x-nexe-status', 'ok'), ('date', 'Mon, 04 Aug 2014 09:44:45 GMT'), ('content-type', 'text/html')]
DEBUG:swiftclient: RESP BODY: hello from zerovm!

DEBUG:zpmlib.zpm: response status: 200
hello from zerovm!

app deployed to
  https://zebra.zerovm.org/v1/AUTH_ABC123/test4/index.html
etoews commented 10 years ago

LGTM! Nice work.