diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-05-01 15:32:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-01 15:32:00 +0200 |
commit | 1230499e45554069f3e6ad073f7e1b0083787213 (patch) | |
tree | 1b135430cd6cde13b663d47f2ee4712dbc001d87 /cmd/podman/common/specgen.go | |
parent | 2f3762eb911258016581187f072a24ac2724be3b (diff) | |
parent | aef7836b38570eb48bd0fd1c1c4ca37e9a9022f4 (diff) | |
download | podman-1230499e45554069f3e6ad073f7e1b0083787213.tar.gz podman-1230499e45554069f3e6ad073f7e1b0083787213.tar.bz2 podman-1230499e45554069f3e6ad073f7e1b0083787213.zip |
Merge pull request #6016 from giuseppe/fix-create
v2, podman: fix create and entrypoint tests
Diffstat (limited to 'cmd/podman/common/specgen.go')
-rw-r--r-- | cmd/podman/common/specgen.go | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/cmd/podman/common/specgen.go b/cmd/podman/common/specgen.go index 96cd630a3..7250f88bb 100644 --- a/cmd/podman/common/specgen.go +++ b/cmd/podman/common/specgen.go @@ -364,20 +364,20 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string s.WorkDir = workDir entrypoint := []string{} userCommand := []string{} - if ep := c.Entrypoint; len(ep) > 0 { - // Check if entrypoint specified is json - if err := json.Unmarshal([]byte(c.Entrypoint), &entrypoint); err != nil { - entrypoint = append(entrypoint, ep) + if c.Entrypoint != nil { + if ep := *c.Entrypoint; len(ep) > 0 { + // Check if entrypoint specified is json + if err := json.Unmarshal([]byte(*c.Entrypoint), &entrypoint); err != nil { + entrypoint = append(entrypoint, ep) + } } + s.Entrypoint = entrypoint } - var command []string - s.Entrypoint = entrypoint - // Build the command // If we have an entry point, it goes first - if len(entrypoint) > 0 { + if c.Entrypoint != nil { command = entrypoint } if len(inputCommand) > 0 { @@ -386,9 +386,12 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string userCommand = append(userCommand, inputCommand...) } - if len(inputCommand) > 0 { + switch { + case len(inputCommand) > 0: s.Command = userCommand - } else { + case c.Entrypoint != nil: + s.Command = []string{} + default: s.Command = command } |