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

This options accepts a file path 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:45:13 +01:00
parent dbbec99361
commit 201920f6a4
2 changed files with 3 additions and 3 deletions

View File

@ -595,7 +595,7 @@ func DefineCreateFlags(cmd *cobra.Command, cf *entities.ContainerCreateOptions,
_ = cmd.RegisterFlagCompletionFunc(pidFileFlagName, completion.AutocompleteDefault) _ = cmd.RegisterFlagCompletionFunc(pidFileFlagName, completion.AutocompleteDefault)
chrootDirsFlagName := "chrootdirs" chrootDirsFlagName := "chrootdirs"
createFlags.StringSliceVar( createFlags.StringArrayVar(
&cf.ChrootDirs, &cf.ChrootDirs,
chrootDirsFlagName, []string{}, chrootDirsFlagName, []string{},
"Chroot directories inside the container", "Chroot directories inside the container",

View File

@ -717,7 +717,7 @@ var _ = Describe("Podman create", func() {
}) })
It("podman create --chrootdirs functionality test", func() { It("podman create --chrootdirs functionality test", func() {
session := podmanTest.Podman([]string{"create", "-t", "--chrootdirs", "/var/local/qwerty", ALPINE, "/bin/cat"}) session := podmanTest.Podman([]string{"create", "-t", "--chrootdirs", "/var/local/qwerty,withcomma", ALPINE, "/bin/cat"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(ExitCleanly()) Expect(session).Should(ExitCleanly())
ctrID := session.OutputToString() ctrID := session.OutputToString()
@ -726,7 +726,7 @@ var _ = Describe("Podman create", func() {
setup.WaitWithDefaultTimeout() setup.WaitWithDefaultTimeout()
Expect(setup).Should(ExitCleanly()) Expect(setup).Should(ExitCleanly())
setup = podmanTest.Podman([]string{"exec", ctrID, "cmp", "/etc/resolv.conf", "/var/local/qwerty/etc/resolv.conf"}) setup = podmanTest.Podman([]string{"exec", ctrID, "cmp", "/etc/resolv.conf", "/var/local/qwerty,withcomma/etc/resolv.conf"})
setup.WaitWithDefaultTimeout() setup.WaitWithDefaultTimeout()
Expect(setup).Should(ExitCleanly()) Expect(setup).Should(ExitCleanly())
}) })