benzoin.py 文件源码

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

项目:benzoin 作者: mpilar 项目源码 文件源码
def wait_for_snapshot_validation(event, context):
    """
    Gets the snapshots involved in the step function and checks for success
    of the MongoDB validator script.
    """
    session = boto3.session.Session(region_name=event.get("region"))

    ec2 = session.resource("ec2")
    snapshot_ids = [vol["snapshot-id"] for vol in event.get("backup-volumes")]
    for sid in snapshot_ids:
        tags = ec2.Snapshot(sid).tags
        if not tags:
            break
        for tag in tags:
            if tag.get("Key") == VALIDATION_TAG_KEY:
                if tag.get("Success") == "false":
                    raise Exception("Validation failed!")
                else:
                    return event
    raise NotReady("Snapshot not validated yet.")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号