示例#1
0
文件: verify.py 项目: zbeekman/umobj
def get_bag_checksumming_algorithm(bucket_name, key_path):
    for algo in bagit.checksum_algos:
        manifest = obj_key(
            bucket_name, '%s/manifest-%s.txt' % (key_path, algo))
        if manifest is not None:
            return algo
    return None
示例#2
0
文件: verify.py 项目: zbeekman/umobj
def obj_checksums(bucket_name, key_path):
    for algo in bagit.checksum_algos:
        manifest = obj_key(
            bucket_name, '%s/manifest-%s.txt' %
            (key_path, algo))
        if manifest is not None:
            checksums = manifest.get_contents_as_string().strip()
            tagmanifest = obj_key(bucket_name, '%s/tagmanifest-%s.txt' %
                                  (key_path, algo))
            if tagmanifest is None:
                log.critical('Bag tag manifest is not found in object store.')
            else:
                checksums += '\n' + \
                    tagmanifest.get_contents_as_string().strip()
            log.debug('Retrieved %d checksums from object store.' %
                      len(checksums))
            return algo, checksums
    return None, None