def _sync_to_uri(self, uri):
"""Copy and sync versioned directory to uri in S3.
Args:
uri (str): S3 URI to sync version to.
"""
cmd_cp = 'aws s3 cp {} {} --recursive --profile {}'.format(self.s3_version_uri, uri, self.env)
# AWS CLI sync does not work as expected bucket to bucket with exact timestamp sync.
cmd_sync = 'aws s3 sync {} {} --delete --exact-timestamps --profile {}'.format(
self.s3_version_uri, uri, self.env)
cp_result = subprocess.run(cmd_cp, check=True, shell=True, stdout=subprocess.PIPE)
LOG.debug("Copy to %s before sync output: %s", uri, cp_result.stdout)
LOG.info("Copied version %s to %s", self.version, uri)
sync_result = subprocess.run(cmd_sync, check=True, shell=True, stdout=subprocess.PIPE)
LOG.debug("Sync to %s command output: %s", uri, sync_result.stdout)
LOG.info("Synced version %s to %s", self.version, uri)
评论列表
文章目录