duplicity-team team mailing list archive
-
duplicity-team team
-
Mailing list archive
-
Message #04458
Re: [Question #656947]: restoring metadata from amazon glacier
Question #656947 on Duplicity changed:
https://answers.launchpad.net/duplicity/+question/656947
edso proposed the following answer:
On 25.08.2017 16:43, Martin wrote:
> Question #656947 on Duplicity changed:
> https://answers.launchpad.net/duplicity/+question/656947
>
> Martin posted a new comment:
> This is my new _boto_single.py.pre_process_download:
>
> def pre_process_download(self, remote_filename, wait=False):
> # Used primarily to restore files in Glacier
> key_name = self.key_prefix + remote_filename
> if not self._listed_keys.get(key_name, False):
> self._listed_keys[key_name] = list(self.bucket.list(key_name))[0]
> key = self._listed_keys[key_name]
> key2 = self.bucket.get_key(key.key) #why do we need key2?
>
> if key2.storage_class == "GLACIER":
> if not key2.expiry_date: # no temp copy avail
> if not key2.ongoing_restore:
> log.Info("File %s is in Glacier storage, restoring" % remote_filename)
> key.restore(days=2) # Shouldn't need this again after 2 days
> if wait:
> log.Info("Waiting for file %s to restore in Glacier" % remote_filename)
> while not key2.expiry_date:
> time.sleep(60)
> self.resetConnection()
> log.Info("File %s was successfully restored in Glacier" % remote_filename)
>
Martin,
the key2 business seems unnecessary. why don't you leave the method as
it is and simply add key.expiry_date as a condition for not restoring?
eg.
# in deep freeze and _no_ temp copy available
if key.storage_class == "GLACIER" and not self.bucket.get_key(key.key).expiry_date:
..ede/duply.net
--
You received this question notification because your team duplicity-team
is an answer contact for Duplicity.