mirror of
https://github.com/containers/podman.git
synced 2025-12-11 01:11:30 +08:00
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:
@@ -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)",
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user