def __redirect(self, src, dest): key = boto.s3.key.Key(self.s3.get_connection(), src) try: if key.get_redirect() == dest: LOGGER.info('Skipping redirect %s', src) return except boto.exception.S3ResponseError as err: if err.status != 404: LOGGER.exception('S3 error creating redirect from %s to %s', src, dest) LOGGER.info('Redirecting %s to %s', src, dest) key.set_redirect(dest)
def set_redirect(self, key, dest): """Redirect a given key to a destination.""" if not self.dry_run: key.set_redirect(dest)
def set_redirect(self, key: boto.s3.key.Key, dest: str) -> None: """Redirect a given key to a destination.""" if not self.dry_run: key.set_redirect(dest)