cli: podman run/create --annotation use StringArray()

This option accepts arbitrary input so we should allow commas in it.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2023-12-07 16:35:25 +01:00
parent c5258d4630
commit ef10073b51
2 changed files with 3 additions and 3 deletions

View File

@@ -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)",

View File

@@ -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() {