← Back to team overview

duplicity-team team mailing list archive

Re: [Question #656947]: restoring metadata from amazon glacier

 

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)

-- 
You received this question notification because your team duplicity-team
is an answer contact for Duplicity.