Пример #1
0
def compare_bucket_content(context, args):
    manifest_path, manifest = _get_path_and_manifest(context,
                                                     args.manifest_path)

    s3 = context.aws.client('s3')
    bucketName = _get_content_bucket(context)
    manifestDict = _create_manifest_bucket_key_map(context, manifest,
                                                   manifest_path)
    for thisKey, thisHash in manifestDict.iteritems():
        try:
            headResponse = s3.head_object(Bucket=bucketName, Key=thisKey)
        except Exception as e:
            show_manifest.key_not_found(thisKey)
            continue
        show_manifest.hash_comparison_bucket(
            thisKey, thisHash, _get_bucket_item_hash(headResponse))
Пример #2
0
def _get_unmatched_content(context, manifest, manifest_path, deployment_name):
    s3 = context.aws.client('s3')
    bucketName = _get_content_bucket_by_name(context, deployment_name)
    manifestDict = _create_manifest_bucket_key_map(context, manifest,
                                                   manifest_path)
    returnDict = {}
    for thisKey, thisHash in manifestDict.iteritems():
        try:
            headResponse = s3.head_object(Bucket=bucketName, Key=thisKey)
        except Exception as e:
            show_manifest.key_not_found(thisKey)
            returnDict[thisKey] = thisHash
            continue
        show_manifest.hash_comparison_bucket(
            thisKey, thisHash, _get_bucket_item_hash(headResponse))
        if _get_bucket_item_hash(headResponse) != thisHash:
            returnDict[thisKey] = thisHash
    return returnDict