mirror of
https://github.com/containers/podman.git
synced 2025-12-12 01:38:04 +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
|
if mode == entities.CreateMode { // regular create flags
|
||||||
annotationFlagName := "annotation"
|
annotationFlagName := "annotation"
|
||||||
createFlags.StringSliceVar(
|
createFlags.StringArrayVar(
|
||||||
&cf.Annotation,
|
&cf.Annotation,
|
||||||
annotationFlagName, []string{},
|
annotationFlagName, []string{},
|
||||||
"Add annotations to container (key=value)",
|
"Add annotations to container (key=value)",
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ var _ = Describe("Podman create", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("podman create adds annotation", 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()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(ExitCleanly())
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
|
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
|
||||||
@@ -109,7 +109,7 @@ var _ = Describe("Podman create", func() {
|
|||||||
check := podmanTest.Podman([]string{"inspect", "annotate_test"})
|
check := podmanTest.Podman([]string{"inspect", "annotate_test"})
|
||||||
check.WaitWithDefaultTimeout()
|
check.WaitWithDefaultTimeout()
|
||||||
data := check.InspectContainerToJSON()
|
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() {
|
It("podman create --entrypoint command", func() {
|
||||||
|
|||||||
Reference in New Issue
Block a user