mirror of
https://github.com/containers/podman.git
synced 2025-06-23 02:18:13 +08:00
Merge pull request #13811 from flouthoc/container_inspect_entrypoint
container,inspect: convert `Entrypoint` to an array instead of a string
This commit is contained in:
@ -367,7 +367,7 @@ func (c *Container) generateInspectContainerConfig(spec *spec.Spec) *define.Insp
|
|||||||
|
|
||||||
// Leave empty if not explicitly overwritten by user
|
// Leave empty if not explicitly overwritten by user
|
||||||
if len(c.config.Entrypoint) != 0 {
|
if len(c.config.Entrypoint) != 0 {
|
||||||
ctrConfig.Entrypoint = strings.Join(c.config.Entrypoint, " ")
|
ctrConfig.Entrypoint = c.config.Entrypoint
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(c.config.Labels) != 0 {
|
if len(c.config.Labels) != 0 {
|
||||||
|
@ -44,7 +44,7 @@ type InspectContainerConfig struct {
|
|||||||
// Container working directory
|
// Container working directory
|
||||||
WorkingDir string `json:"WorkingDir"`
|
WorkingDir string `json:"WorkingDir"`
|
||||||
// Container entrypoint
|
// Container entrypoint
|
||||||
Entrypoint string `json:"Entrypoint"`
|
Entrypoint []string `json:"Entrypoint"`
|
||||||
// On-build arguments - presently unused. More of Buildah's domain.
|
// On-build arguments - presently unused. More of Buildah's domain.
|
||||||
OnBuild *string `json:"OnBuild"`
|
OnBuild *string `json:"OnBuild"`
|
||||||
// Container labels
|
// Container labels
|
||||||
|
@ -118,7 +118,7 @@ var _ = Describe("Podman create", func() {
|
|||||||
result := podmanTest.Podman([]string{"inspect", "entrypoint_test", "--format", "{{.Config.Entrypoint}}"})
|
result := podmanTest.Podman([]string{"inspect", "entrypoint_test", "--format", "{{.Config.Entrypoint}}"})
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
Expect(result).Should(Exit(0))
|
Expect(result).Should(Exit(0))
|
||||||
Expect(result.OutputToString()).To(Equal("/bin/foobar"))
|
Expect(result.OutputToString()).To(Equal("[/bin/foobar]"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman create --entrypoint \"\"", func() {
|
It("podman create --entrypoint \"\"", func() {
|
||||||
@ -130,7 +130,7 @@ var _ = Describe("Podman create", func() {
|
|||||||
result := podmanTest.Podman([]string{"inspect", session.OutputToString(), "--format", "{{.Config.Entrypoint}}"})
|
result := podmanTest.Podman([]string{"inspect", session.OutputToString(), "--format", "{{.Config.Entrypoint}}"})
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
Expect(result).Should(Exit(0))
|
Expect(result).Should(Exit(0))
|
||||||
Expect(result.OutputToString()).To(Equal(""))
|
Expect(result.OutputToString()).To(Equal("[]"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman create --entrypoint json", func() {
|
It("podman create --entrypoint json", func() {
|
||||||
@ -143,7 +143,7 @@ var _ = Describe("Podman create", func() {
|
|||||||
result := podmanTest.Podman([]string{"inspect", "entrypoint_json", "--format", "{{.Config.Entrypoint}}"})
|
result := podmanTest.Podman([]string{"inspect", "entrypoint_json", "--format", "{{.Config.Entrypoint}}"})
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
Expect(result).Should(Exit(0))
|
Expect(result).Should(Exit(0))
|
||||||
Expect(result.OutputToString()).To(Equal("/bin/foo -c"))
|
Expect(result.OutputToString()).To(Equal("[/bin/foo -c]"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman create --mount flag with multiple mounts", func() {
|
It("podman create --mount flag with multiple mounts", func() {
|
||||||
@ -281,7 +281,8 @@ var _ = Describe("Podman create", func() {
|
|||||||
Expect(ctrJSON).To(HaveLen(1))
|
Expect(ctrJSON).To(HaveLen(1))
|
||||||
Expect(ctrJSON[0].Config.Cmd).To(HaveLen(1))
|
Expect(ctrJSON[0].Config.Cmd).To(HaveLen(1))
|
||||||
Expect(ctrJSON[0].Config.Cmd[0]).To(Equal("redis-server"))
|
Expect(ctrJSON[0].Config.Cmd[0]).To(Equal("redis-server"))
|
||||||
Expect(ctrJSON[0].Config.Entrypoint).To(Equal("docker-entrypoint.sh"))
|
Expect(ctrJSON[0].Config.Entrypoint).To(HaveLen(1))
|
||||||
|
Expect(ctrJSON[0].Config.Entrypoint[0]).To(Equal("docker-entrypoint.sh"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman create --pull", func() {
|
It("podman create --pull", func() {
|
||||||
|
@ -368,7 +368,7 @@ var _ = Describe("Podman pod create", func() {
|
|||||||
check1 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Config.Entrypoint}}", data.Containers[0].ID})
|
check1 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Config.Entrypoint}}", data.Containers[0].ID})
|
||||||
check1.WaitWithDefaultTimeout()
|
check1.WaitWithDefaultTimeout()
|
||||||
Expect(check1).Should(Exit(0))
|
Expect(check1).Should(Exit(0))
|
||||||
Expect(check1.OutputToString()).To(Equal("/catatonit -P"))
|
Expect(check1.OutputToString()).To(Equal("[/catatonit -P]"))
|
||||||
|
|
||||||
// check the Path and Args
|
// check the Path and Args
|
||||||
check2 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Path}}:{{.Args}}", data.Containers[0].ID})
|
check2 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Path}}:{{.Args}}", data.Containers[0].ID})
|
||||||
@ -391,7 +391,7 @@ var _ = Describe("Podman pod create", func() {
|
|||||||
check1 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Config.Entrypoint}}", data.Containers[0].ID})
|
check1 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Config.Entrypoint}}", data.Containers[0].ID})
|
||||||
check1.WaitWithDefaultTimeout()
|
check1.WaitWithDefaultTimeout()
|
||||||
Expect(check1).Should(Exit(0))
|
Expect(check1).Should(Exit(0))
|
||||||
Expect(check1.OutputToString()).To(Equal("/pause1"))
|
Expect(check1.OutputToString()).To(Equal("[/pause1]"))
|
||||||
|
|
||||||
// check the Path and Args
|
// check the Path and Args
|
||||||
check2 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Path}}:{{.Args}}", data.Containers[0].ID})
|
check2 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Path}}:{{.Args}}", data.Containers[0].ID})
|
||||||
@ -418,7 +418,7 @@ entrypoint ["/fromimage"]
|
|||||||
check1 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Config.Entrypoint}}", data.Containers[0].ID})
|
check1 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Config.Entrypoint}}", data.Containers[0].ID})
|
||||||
check1.WaitWithDefaultTimeout()
|
check1.WaitWithDefaultTimeout()
|
||||||
Expect(check1).Should(Exit(0))
|
Expect(check1).Should(Exit(0))
|
||||||
Expect(check1.OutputToString()).To(Equal("/fromimage"))
|
Expect(check1.OutputToString()).To(Equal("[/fromimage]"))
|
||||||
|
|
||||||
// check the Path and Args
|
// check the Path and Args
|
||||||
check2 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Path}}:{{.Args}}", data.Containers[0].ID})
|
check2 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Path}}:{{.Args}}", data.Containers[0].ID})
|
||||||
@ -445,7 +445,7 @@ entrypoint ["/fromimage"]
|
|||||||
check1 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Config.Entrypoint}}", data.Containers[0].ID})
|
check1 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Config.Entrypoint}}", data.Containers[0].ID})
|
||||||
check1.WaitWithDefaultTimeout()
|
check1.WaitWithDefaultTimeout()
|
||||||
Expect(check1).Should(Exit(0))
|
Expect(check1).Should(Exit(0))
|
||||||
Expect(check1.OutputToString()).To(Equal("/fromcommand"))
|
Expect(check1.OutputToString()).To(Equal("[/fromcommand]"))
|
||||||
|
|
||||||
// check the Path and Args
|
// check the Path and Args
|
||||||
check2 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Path}}:{{.Args}}", data.Containers[0].ID})
|
check2 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Path}}:{{.Args}}", data.Containers[0].ID})
|
||||||
|
@ -234,7 +234,7 @@ EOF
|
|||||||
local infra_cid="$output"
|
local infra_cid="$output"
|
||||||
# confirm that entrypoint is what we set
|
# confirm that entrypoint is what we set
|
||||||
run_podman container inspect --format '{{.Config.Entrypoint}}' $infra_cid
|
run_podman container inspect --format '{{.Config.Entrypoint}}' $infra_cid
|
||||||
is "$output" "$infra_command" "infra-command took effect"
|
is "$output" "[$infra_command]" "infra-command took effect"
|
||||||
# confirm that infra container name is set
|
# confirm that infra container name is set
|
||||||
run_podman container inspect --format '{{.Name}}' $infra_cid
|
run_podman container inspect --format '{{.Name}}' $infra_cid
|
||||||
is "$output" "$infra_name" "infra-name took effect"
|
is "$output" "$infra_name" "infra-name took effect"
|
||||||
|
Reference in New Issue
Block a user