From ef10073b51970cbdd5559526bd323b30c3924dae Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Thu, 7 Dec 2023 16:35:25 +0100 Subject: [PATCH] cli: podman run/create --annotation use StringArray() This option accepts arbitrary input so we should allow commas in it. Signed-off-by: Paul Holzinger --- cmd/podman/common/create.go | 2 +- test/e2e/create_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/podman/common/create.go b/cmd/podman/common/create.go index 105ea13c56..3c3a580497 100644 --- a/cmd/podman/common/create.go +++ b/cmd/podman/common/create.go @@ -33,7 +33,7 @@ func DefineCreateFlags(cmd *cobra.Command, cf *entities.ContainerCreateOptions, if mode == entities.CreateMode { // regular create flags annotationFlagName := "annotation" - createFlags.StringSliceVar( + createFlags.StringArrayVar( &cf.Annotation, annotationFlagName, []string{}, "Add annotations to container (key=value)", diff --git a/test/e2e/create_test.go b/test/e2e/create_test.go index f9aa0f8bbd..8d777647e6 100644 --- a/test/e2e/create_test.go +++ b/test/e2e/create_test.go @@ -101,7 +101,7 @@ var _ = Describe("Podman create", func() { }) It("podman create adds annotation", func() { - session := podmanTest.Podman([]string{"create", "--annotation", "HELLO=WORLD", "--name", "annotate_test", ALPINE, "ls"}) + session := podmanTest.Podman([]string{"create", "--annotation", "HELLO=WORLD,WithComma", "--name", "annotate_test", ALPINE, "ls"}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) Expect(podmanTest.NumberOfContainers()).To(Equal(1)) @@ -109,7 +109,7 @@ var _ = Describe("Podman create", func() { check := podmanTest.Podman([]string{"inspect", "annotate_test"}) check.WaitWithDefaultTimeout() data := check.InspectContainerToJSON() - Expect(data[0].Config.Annotations).To(HaveKeyWithValue("HELLO", "WORLD")) + Expect(data[0].Config.Annotations).To(HaveKeyWithValue("HELLO", "WORLD,WithComma")) }) It("podman create --entrypoint command", func() {