From cf7c8295b8875ddd4fe87a4207aa302efbd90b18 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Thu, 7 Jun 2018 01:00:07 -0400 Subject: Vendor in latest buildah code Use the parsing code to properly setup podman build namespaces Fixes support for network namespace and user namespace Signed-off-by: Daniel J Walsh Closes: #917 Approved by: rhatdan --- vendor/github.com/projectatomic/buildah/pull.go | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'vendor/github.com/projectatomic/buildah/pull.go') diff --git a/vendor/github.com/projectatomic/buildah/pull.go b/vendor/github.com/projectatomic/buildah/pull.go index edfaa6216..e1310f7ce 100644 --- a/vendor/github.com/projectatomic/buildah/pull.go +++ b/vendor/github.com/projectatomic/buildah/pull.go @@ -8,6 +8,7 @@ import ( "github.com/containers/image/docker/reference" tarfile "github.com/containers/image/docker/tarfile" ociarchive "github.com/containers/image/oci/archive" + "github.com/containers/image/pkg/sysregistries" "github.com/containers/image/signature" is "github.com/containers/image/storage" "github.com/containers/image/transports" @@ -166,12 +167,25 @@ func pullImage(ctx context.Context, store storage.Store, imageName string, optio }() logrus.Debugf("copying %q to %q", spec, destName) - err = cp.Image(ctx, policyContext, destRef, srcRef, getCopyOptions(options.ReportWriter, options.SystemContext, nil, "")) if err == nil { return destRef, nil } - return nil, err + + // If no image was found, we should handle. Lets be nicer to the user and see if we can figure out why. + registryPath := sysregistries.RegistriesConfPath(&types.SystemContext{}) + searchRegistries, err := getRegistries() + if err != nil { + return nil, err + } + hasRegistryInName, err := hasRegistry(imageName) + if err != nil { + return nil, err + } + if !hasRegistryInName && len(searchRegistries) == 0 { + return nil, errors.Errorf("image name provided is a short name and no search registries are defined in %s.", registryPath) + } + return nil, errors.Errorf("unable to find image in the registries defined in %q", registryPath) } // getImageDigest creates an image object and uses the hex value of the digest as the image ID -- cgit v1.2.3-54-g00ecf