uskudnik / amazon-glacier-cmd-interface

Command line interface for Amazon Glacier
MIT License
374 stars 100 forks source link

Better graceful handling of first inventory while no initial generated #75

Open tuctboh opened 11 years ago

tuctboh commented 11 years ago

[dbadmin@w-db-06 archived_data]$ glacier-cmd inventory DB-2012-01 Traceback (most recent call last): File "/usr/bin/glacier-cmd", line 8, in load_entry_point('glacier==0.2dev', 'console_scripts', 'glacier-cmd')() File "/opt/python2.7/lib/python2.7/site-packages/glacier-0.2dev-py2.7.egg/glacier/glacier.py", line 521, in main args.func(args) File "/opt/python2.7/lib/python2.7/site-packages/glacier-0.2dev-py2.7.egg/glacier/glacier.py", line 235, in inventory job, inventory = glacier.inventory(args.vault, args.refresh) File "/opt/python2.7/lib/python2.7/site-packages/glacier-0.2dev-py2.7.egg/glacier/GlacierWrapper.py", line 52, in wrapper ret = fn(_args, _kwargs) File "/opt/python2.7/lib/python2.7/site-packages/glacier-0.2dev-py2.7.egg/glacier/GlacierWrapper.py", line 289, in glacier_connect_wrap return func(_args, _kwargs) File "/opt/python2.7/lib/python2.7/site-packages/glacier-0.2dev-py2.7.egg/glacier/GlacierWrapper.py", line 52, in wrapper ret = fn(_args, *_kwargs) File "/opt/python2.7/lib/python2.7/site-packages/glacier-0.2dev-py2.7.egg/glacier/GlacierWrapper.py", line 1397, in inventory inventory_job = gv.retrieve_inventory(format="JSON") File "/opt/python2.7/lib/python2.7/site-packages/glacier-0.2dev-py2.7.egg/glacier/glaciercorecalls.py", line 118, in retrieve_inventory job.initiate() File "/opt/python2.7/lib/python2.7/site-packages/glacier-0.2dev-py2.7.egg/glacier/glaciercorecalls.py", line 182, in initiate raise Exception(msg, response.read()) Exception: ('Start job expected 202 back (got 404)', '{"code":"ResourceNotFoundException","message":"Inventory retrieval jobs for vault arn:aws:glacier:us-east-1:24346345435643543:vaults/DB-2012-01 cannot be initiated yet, as Amazon Glacier has not yet generated an initial inventory for this vault.","type":"Client"}')

wvmarle commented 11 years ago

Error handling has been improved; this one is being caught properly in my code (some not being pulled into master yet). You will get the same stack trace when you do glacier-cmd inventory non-existing-vault.

wouter@acorn:~$ glacier-cmd mkvault new_vault
+-----------+-------------------------------------------------+
|   Header  |                      Value                      |
+-----------+-------------------------------------------------+
| RequestId | DjShPFgvv-hULFSvcDMqtr_cewS60jUPXX4ETyvxMRiJJHY |
|  Location |          /335522851586/vaults/new_vault         |
+-----------+-------------------------------------------------+
wouter@acorn:~$ glacier-cmd inventory new_vault
Checking inventory, please wait.
str: Failed to create a new inventory retrieval job for vault new_vault.
Caused by: 1 exception
||  unicode: Inventory retrieval jobs for vault arn:aws:glacier:us-east-1:335522851586:vaults/new_vault cannot be initiated yet, as Amazon Glacier has not yet generated an initial inventory for this vault.

The only things that I can't manage to get rid of (I also don't know where exactly they come from) are the words str: and unicode:. This are the respective string types of these two lines.