s3apps.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:foremast 作者: gogoair 项目源码 文件源码
def _put_bucket_tagging(self):
        """Add new Tags without overwriting old Tags.

        Regular put_bucket_tagging sets TagSet which overwrites old tags. Below
        logic keeps the old tags in place as well.
        """
        try:
            # Get current tags list, if no tags exist will get an exception.
            result = self.s3client.get_bucket_tagging(Bucket=self.bucket)['TagSet']
        except ClientError as error:
            LOG.warning(error)
            result = []

        # Make simplified dictionary of tags from result
        all_tags = {}
        for tag in result:
            all_tags.update({tag.get('Key'): tag.get('Value')})

        all_tags.update({'app_group': self.group, 'app_name': self.app_name})

        tag_set = generate_s3_tags.generated_tag_data(all_tags)

        self.s3client.put_bucket_tagging(Bucket=self.bucket, Tagging={'TagSet': tag_set})
        LOG.info("Adding tagging %s for Bucket", tag_set)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号