From 201920f6a4b967e7a4bef366aae4f4b7592de7c7 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Thu, 7 Dec 2023 16:45:13 +0100 Subject: [PATCH] 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 --- 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 45c136985e..223fb2e12e 100644 --- a/cmd/podman/common/create.go +++ b/cmd/podman/common/create.go @@ -595,7 +595,7 @@ func DefineCreateFlags(cmd *cobra.Command, cf *entities.ContainerCreateOptions, _ = cmd.RegisterFlagCompletionFunc(pidFileFlagName, completion.AutocompleteDefault) chrootDirsFlagName := "chrootdirs" - createFlags.StringSliceVar( + createFlags.StringArrayVar( &cf.ChrootDirs, chrootDirsFlagName, []string{}, "Chroot directories inside the container", diff --git a/test/e2e/create_test.go b/test/e2e/create_test.go index 8d777647e6..df753ce461 100644 --- a/test/e2e/create_test.go +++ b/test/e2e/create_test.go @@ -717,7 +717,7 @@ var _ = Describe("Podman create", 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() Expect(session).Should(ExitCleanly()) ctrID := session.OutputToString() @@ -726,7 +726,7 @@ var _ = Describe("Podman create", func() { setup.WaitWithDefaultTimeout() 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() Expect(setup).Should(ExitCleanly()) })