diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-07-15 21:57:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-15 21:57:52 +0200 |
commit | d2291ecdd514befd18a8b57ff2c7a8ef0cf04ba8 (patch) | |
tree | 602b422fd8ad2b35211cf5a3c4cc70b9c4912199 /cmd/podman/shared | |
parent | a28f8dbecd2a28c6e4e2ea2aa95b75dda4b0adb4 (diff) | |
parent | e4cba7d36a49353febfefcb25d2d820bc89e9d1b (diff) | |
download | podman-d2291ecdd514befd18a8b57ff2c7a8ef0cf04ba8.tar.gz podman-d2291ecdd514befd18a8b57ff2c7a8ef0cf04ba8.tar.bz2 podman-d2291ecdd514befd18a8b57ff2c7a8ef0cf04ba8.zip |
Merge pull request #3574 from stefanb2/topic-health-cmd-parsing
Improve parser for --healthcheck-command
Diffstat (limited to 'cmd/podman/shared')
-rw-r--r-- | cmd/podman/shared/create.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/cmd/podman/shared/create.go b/cmd/podman/shared/create.go index be1a731cc..17455c4c9 100644 --- a/cmd/podman/shared/create.go +++ b/cmd/podman/shared/create.go @@ -26,7 +26,6 @@ import ( "github.com/docker/docker/pkg/signal" "github.com/docker/go-connections/nat" "github.com/docker/go-units" - "github.com/google/shlex" "github.com/opencontainers/selinux/go-selinux/label" "github.com/opentracing/opentracing-go" "github.com/pkg/errors" @@ -788,9 +787,12 @@ func makeHealthCheckFromCli(c *GenericCLIResults) (*manifest.Schema2HealthConfig return nil, errors.New("Must define a healthcheck command for all healthchecks") } - cmd, err := shlex.Split(inCommand) + // first try to parse option value as JSON array of strings... + cmd := []string{} + err := json.Unmarshal([]byte(inCommand), &cmd) if err != nil { - return nil, errors.Wrap(err, "failed to parse healthcheck command") + // ...otherwise pass it to "/bin/sh -c" inside the container + cmd = []string{"CMD-SHELL", inCommand} } hc := manifest.Schema2HealthConfig{ Test: cmd, |