diff options
author | Miloslav Trmač <mitr@redhat.com> | 2018-08-01 23:36:07 +0200 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-08-02 13:17:17 +0000 |
commit | 4cf9308bf25ce172b89bc6dc6a5a328dc3b254d5 (patch) | |
tree | 39d7fdc43e76e20067a09f026234185f349d2095 /libpod/image | |
parent | 48763b14aedc6c90ab635e0c7a8ba3e35d051e92 (diff) | |
download | podman-4cf9308bf25ce172b89bc6dc6a5a328dc3b254d5.tar.gz podman-4cf9308bf25ce172b89bc6dc6a5a328dc3b254d5.tar.bz2 podman-4cf9308bf25ce172b89bc6dc6a5a328dc3b254d5.zip |
Introduce getSinglePullRefNameGoal
This merely wraps the
> return singlePullRefNameGoal(getPullRefName(... reference)), nil
pattern which is used for almost all getPullRefName uses. For now
it seems not really worth it, but it will result in shorter code
(and smaller migration) after we replace getPullRefName with
getPullRefPair, which can fail, again - the pullGoalNamesFromImageReference
will not have to add any error handling.
Should not change behavior.
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Closes: #1198
Approved by: mheon
Diffstat (limited to 'libpod/image')
-rw-r--r-- | libpod/image/pull.go | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/libpod/image/pull.go b/libpod/image/pull.go index f3a10d94d..7d5bd4727 100644 --- a/libpod/image/pull.go +++ b/libpod/image/pull.go @@ -107,6 +107,12 @@ func getPullRefName(srcRef types.ImageReference, destName string) pullRefName { } } +// getSinglePullRefNameGoal calls getPullRefName with the specified parameters, and returns a single-pair goal for the return value. +func getSinglePullRefNameGoal(srcRef types.ImageReference, destName string) (*pullGoalNames, error) { + rn := getPullRefName(srcRef, destName) + return singlePullRefNameGoal(rn), nil +} + // pullGoalNamesFromImageReference returns a pullGoalNames for a single ImageReference, depending on the used transport. func pullGoalNamesFromImageReference(ctx context.Context, srcRef types.ImageReference, imgName string, sc *types.SystemContext) (*pullGoalNames, error) { // supports pulling from docker-archive, oci, and registries @@ -129,7 +135,7 @@ func pullGoalNamesFromImageReference(ctx context.Context, srcRef types.ImageRefe if err != nil { return nil, err } - return singlePullRefNameGoal(getPullRefName(srcRef, reference)), nil + return getSinglePullRefNameGoal(srcRef, reference) } if len(manifest[0].RepoTags) == 0 { @@ -138,7 +144,7 @@ func pullGoalNamesFromImageReference(ctx context.Context, srcRef types.ImageRefe if err != nil { return nil, err } - return singlePullRefNameGoal(getPullRefName(srcRef, digest)), nil + return getSinglePullRefNameGoal(srcRef, digest) } // Need to load in all the repo tags from the manifest @@ -172,7 +178,7 @@ func pullGoalNamesFromImageReference(ctx context.Context, srcRef types.ImageRefe } else { dest = manifest.Annotations["org.opencontainers.image.ref.name"] } - return singlePullRefNameGoal(getPullRefName(srcRef, dest)), nil + return getSinglePullRefNameGoal(srcRef, dest) case DirTransport: path := srcRef.StringWithinTransport() @@ -183,10 +189,10 @@ func pullGoalNamesFromImageReference(ctx context.Context, srcRef types.ImageRefe // so docker.io isn't prepended, and the path becomes the repository image = DefaultLocalRepo + image } - return singlePullRefNameGoal(getPullRefName(srcRef, image)), nil + return getSinglePullRefNameGoal(srcRef, image) default: - return singlePullRefNameGoal(getPullRefName(srcRef, imgName)), nil + return getSinglePullRefNameGoal(srcRef, imgName) } } |