예제 #1
0
def _backfill_labels(tag_manifest, manifest, repository):
    tmls = list(TagManifestLabel.select().where(
        TagManifestLabel.annotated == tag_manifest))
    if not tmls:
        return

    for tag_manifest_label in tmls:
        label = tag_manifest_label.label
        try:
            TagManifestLabelMap.get(tag_manifest_label=tag_manifest_label)
            continue
        except TagManifestLabelMap.DoesNotExist:
            pass

        try:
            manifest_label = ManifestLabel.create(manifest=manifest,
                                                  label=label,
                                                  repository=repository)
            TagManifestLabelMap.create(
                manifest_label=manifest_label,
                tag_manifest_label=tag_manifest_label,
                label=label,
                manifest=manifest,
                tag_manifest=tag_manifest_label.annotated)
        except IntegrityError:
            continue
예제 #2
0
def lookup_map_row(tag_manifest_label):
    try:
        TagManifestLabelMap.get(tag_manifest_label=tag_manifest_label)
        return True
    except TagManifestLabelMap.DoesNotExist:
        return False