uskudnik / amazon-glacier-cmd-interface

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

Bookkeeping: upload adds entry, rmarchive does nothing? #130

Open elonen opened 11 years ago

elonen commented 11 years ago

It looks like uploading a file adds an entry to simpledb but the rmarchive command currently doesn't delete it. Is this a bug or a feature?

elonen commented 11 years ago

Hmm, now "rmarchive" suddenly updates the bookkeeping correctly, apparently after a successful inventory. Evidently it is some kind of a bug but I can't really figure out what is the logic behind it.

wvmarle commented 11 years ago

It seems to be a bug indeed; will have to look into it. Been busy with other things lately, no programming done.

After retrieving an inventory from Amazon Glacier, the bookkeeping database is updated to reflect the current inventory (i.e. items that are not present in the inventory will be removed from the database, and items that are in the inventory but not in the database will be added).

And that's exactly what you see: rmarchive removed the archive from the vault (but for some reason the bookkeeping database was not update - that's a bug), and when you do an inventory request after the removal, that archive is not in the inventory that Glacier provides, and as such is removed from the bookkeeping database.

ghost commented 9 years ago

It seems that GlacierWrapper.upload() adds a cache entry with file_attrs['filename'] as the key, but GlacierWrapper.rmarchive() tries to find a cache by archive_id and remove it. I think GlacierWrapper.upload() should use archive_id instead of filename.

upload: https://github.com/uskudnik/amazon-glacier-cmd-interface/blob/master/glacier/GlacierWrapper.py#L1236 self.sdb_domain.put_attributes(file_attrs['filename'], file_attrs)

rmarchive: https://github.com/uskudnik/amazon-glacier-cmd-interface/blob/master/glacier/GlacierWrapper.py#L1556

item = self.sdb_domain.get_item(archive_id)
if item:
    self.sdb_domain.delete_item(item)