diff options
author | Toshiki Sonoda <sonoda.toshiki@fujitsu.com> | 2022-09-29 11:01:33 +0900 |
---|---|---|
committer | Toshiki Sonoda <sonoda.toshiki@fujitsu.com> | 2022-09-29 18:14:41 +0900 |
commit | 32f54a81ed797597827123b671b6e73194354327 (patch) | |
tree | 2aefb9f7a39a2b385389b78e56acfaaa2e8e2edd /pkg/domain | |
parent | b7eee0b2ce1eb19804ebed6184d0ad2a4bd91fb9 (diff) | |
download | podman-32f54a81ed797597827123b671b6e73194354327.tar.gz podman-32f54a81ed797597827123b671b6e73194354327.tar.bz2 podman-32f54a81ed797597827123b671b6e73194354327.zip |
remote: fix manifest add --annotation
* `manifest add --annotation option` adds annotations
field on remote environment.
* `manifest inspect` prints annotations field
on remote environment.
Fixes: #15952
Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
Diffstat (limited to 'pkg/domain')
-rw-r--r-- | pkg/domain/entities/manifest.go | 2 | ||||
-rw-r--r-- | pkg/domain/infra/tunnel/manifest.go | 18 |
2 files changed, 4 insertions, 16 deletions
diff --git a/pkg/domain/entities/manifest.go b/pkg/domain/entities/manifest.go index f17079271..7f4b6c25f 100644 --- a/pkg/domain/entities/manifest.go +++ b/pkg/domain/entities/manifest.go @@ -36,7 +36,7 @@ type ManifestAddOptions struct { // ManifestAnnotateOptions provides model for annotating manifest list type ManifestAnnotateOptions struct { // Annotation to add to manifest list - Annotation []string `json:"annotation" schema:"annotation"` + Annotation []string `json:"annotations" schema:"annotations"` // Arch overrides the architecture for the image Arch string `json:"arch" schema:"arch"` // Feature list for the image diff --git a/pkg/domain/infra/tunnel/manifest.go b/pkg/domain/infra/tunnel/manifest.go index 696d0a963..2fe43aad0 100644 --- a/pkg/domain/infra/tunnel/manifest.go +++ b/pkg/domain/infra/tunnel/manifest.go @@ -5,7 +5,6 @@ import ( "encoding/json" "errors" "fmt" - "strings" "github.com/containers/image/v5/types" "github.com/containers/podman/v4/pkg/bindings/images" @@ -48,20 +47,9 @@ func (ir *ImageEngine) ManifestInspect(_ context.Context, name string) ([]byte, // ManifestAdd adds images to the manifest list func (ir *ImageEngine) ManifestAdd(_ context.Context, name string, imageNames []string, opts entities.ManifestAddOptions) (string, error) { - options := new(manifests.AddOptions).WithAll(opts.All).WithArch(opts.Arch).WithVariant(opts.Variant) - options.WithFeatures(opts.Features).WithImages(imageNames).WithOS(opts.OS).WithOSVersion(opts.OSVersion) - options.WithUsername(opts.Username).WithPassword(opts.Password).WithAuthfile(opts.Authfile) - if len(opts.Annotation) != 0 { - annotations := make(map[string]string) - for _, annotationSpec := range opts.Annotation { - spec := strings.SplitN(annotationSpec, "=", 2) - if len(spec) != 2 { - return "", fmt.Errorf("no value given for annotation %q", spec[0]) - } - annotations[spec[0]] = spec[1] - } - options.WithAnnotation(annotations) - } + options := new(manifests.AddOptions).WithAll(opts.All).WithAnnotation(opts.Annotation).WithArch(opts.Arch) + options.WithVariant(opts.Variant).WithFeatures(opts.Features).WithImages(imageNames).WithOS(opts.OS) + options.WithOSVersion(opts.OSVersion).WithUsername(opts.Username).WithPassword(opts.Password).WithAuthfile(opts.Authfile) if s := opts.SkipTLSVerify; s != types.OptionalBoolUndefined { if s == types.OptionalBoolTrue { options.WithSkipTLSVerify(true) |