diff options
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/image/filters.go | 4 | ||||
-rw-r--r-- | libpod/image/image.go | 10 | ||||
-rw-r--r-- | libpod/image/search.go | 2 | ||||
-rw-r--r-- | libpod/networking_linux.go | 6 |
4 files changed, 12 insertions, 10 deletions
diff --git a/libpod/image/filters.go b/libpod/image/filters.go index db647954f..4aff0a7b5 100644 --- a/libpod/image/filters.go +++ b/libpod/image/filters.go @@ -82,7 +82,7 @@ func LabelFilter(ctx context.Context, labelfilter string) ResultFilter { // We need to handle both label=key and label=key=value return func(i *Image) bool { var value string - splitFilter := strings.Split(labelfilter, "=") + splitFilter := strings.SplitN(labelfilter, "=", 2) key := splitFilter[0] if len(splitFilter) > 1 { value = splitFilter[1] @@ -157,7 +157,7 @@ func (ir *Runtime) createFilterFuncs(filters []string, img *Image) ([]ResultFilt var filterFuncs []ResultFilter ctx := context.Background() for _, filter := range filters { - splitFilter := strings.Split(filter, "=") + splitFilter := strings.SplitN(filter, "=", 2) if len(splitFilter) < 2 { return nil, errors.Errorf("invalid filter syntax %s", filter) } diff --git a/libpod/image/image.go b/libpod/image/image.go index 0900944eb..301954703 100644 --- a/libpod/image/image.go +++ b/libpod/image/image.go @@ -177,7 +177,7 @@ func (ir *Runtime) New(ctx context.Context, name, signaturePolicyPath, authfile // SaveImages stores one more images in a multi-image archive. // Note that only `docker-archive` supports storing multiple // image. -func (ir *Runtime) SaveImages(ctx context.Context, namesOrIDs []string, format string, outputFile string, quiet bool) (finalErr error) { +func (ir *Runtime) SaveImages(ctx context.Context, namesOrIDs []string, format string, outputFile string, quiet, removeSignatures bool) (finalErr error) { if format != DockerArchive { return errors.Errorf("multi-image archives are only supported in in the %q format", DockerArchive) } @@ -264,7 +264,7 @@ func (ir *Runtime) SaveImages(ctx context.Context, namesOrIDs []string, format s } img := imageMap[id] - copyOptions := getCopyOptions(sys, writer, nil, nil, SigningOptions{}, "", img.tags) + copyOptions := getCopyOptions(sys, writer, nil, nil, SigningOptions{RemoveSignatures: removeSignatures}, "", img.tags) copyOptions.DestinationCtx.SystemRegistriesConfPath = registries.SystemRegistriesConfPath() // For copying, we need a source reference that we can create @@ -469,7 +469,7 @@ func (ir *Runtime) getLocalImage(inputName string) (string, *storage.Image, erro if err != nil { return "", nil, err } - img, err := ir.store.Image(ref.String()) + img, err := ir.store.Image(reference.TagNameOnly(ref).String()) if err == nil { return ref.String(), img, nil } @@ -1584,7 +1584,7 @@ func (i *Image) Comment(ctx context.Context, manifestType string) (string, error } // Save writes a container image to the filesystem -func (i *Image) Save(ctx context.Context, source, format, output string, moreTags []string, quiet, compress bool) error { +func (i *Image) Save(ctx context.Context, source, format, output string, moreTags []string, quiet, compress, removeSignatures bool) error { var ( writer io.Writer destRef types.ImageReference @@ -1636,7 +1636,7 @@ func (i *Image) Save(ctx context.Context, source, format, output string, moreTag return err } } - if err := i.PushImageToReference(ctx, destRef, manifestType, "", "", "", writer, compress, SigningOptions{}, &DockerRegistryOptions{}, additionaltags); err != nil { + if err := i.PushImageToReference(ctx, destRef, manifestType, "", "", "", writer, compress, SigningOptions{RemoveSignatures: removeSignatures}, &DockerRegistryOptions{}, additionaltags); err != nil { return errors.Wrapf(err, "unable to save %q", source) } i.newImageEvent(events.Save) diff --git a/libpod/image/search.go b/libpod/image/search.go index 5f5845989..b9acf4a20 100644 --- a/libpod/image/search.go +++ b/libpod/image/search.go @@ -263,7 +263,7 @@ func searchRepositoryTags(registry, term string, sc *types.SystemContext, option func ParseSearchFilter(filter []string) (*SearchFilter, error) { sFilter := new(SearchFilter) for _, f := range filter { - arr := strings.Split(f, "=") + arr := strings.SplitN(f, "=", 2) switch arr[0] { case "stars": if len(arr) < 2 { diff --git a/libpod/networking_linux.go b/libpod/networking_linux.go index df0ff6c32..9ff6e40b7 100644 --- a/libpod/networking_linux.go +++ b/libpod/networking_linux.go @@ -254,9 +254,11 @@ func (r *Runtime) setupSlirp4netns(ctr *Container) error { if ctr.config.NetworkOptions != nil { slirpOptions := ctr.config.NetworkOptions["slirp4netns"] for _, o := range slirpOptions { - parts := strings.Split(o, "=") + parts := strings.SplitN(o, "=", 2) + if len(parts) < 2 { + return errors.Errorf("unknown option for slirp4netns: %q", o) + } option, value := parts[0], parts[1] - switch option { case "cidr": ipv4, _, err := net.ParseCIDR(value) |