diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-03-03 14:18:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-03 14:18:28 +0100 |
commit | 34baea814ba6af58e7f7b65622fd0fb7b838fbf7 (patch) | |
tree | 0ac13e0869ade22faf212a0cf2602ac832d90820 /pkg/adapter/containers_remote.go | |
parent | 1641ee61802ad5e13a9ddf0a20099fe31f73768d (diff) | |
parent | ad8e0e5e49a96146d52cfa41945afbe973ba30af (diff) | |
download | podman-34baea814ba6af58e7f7b65622fd0fb7b838fbf7.tar.gz podman-34baea814ba6af58e7f7b65622fd0fb7b838fbf7.tar.bz2 podman-34baea814ba6af58e7f7b65622fd0fb7b838fbf7.zip |
Merge pull request #5367 from vrothberg/ENVFIX
consolidate env handling into pkg/env
Diffstat (limited to 'pkg/adapter/containers_remote.go')
-rw-r--r-- | pkg/adapter/containers_remote.go | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/pkg/adapter/containers_remote.go b/pkg/adapter/containers_remote.go index 60ee3cb2d..32a84b60d 100644 --- a/pkg/adapter/containers_remote.go +++ b/pkg/adapter/containers_remote.go @@ -15,11 +15,11 @@ import ( "github.com/containers/libpod/cmd/podman/cliconfig" "github.com/containers/libpod/cmd/podman/shared" - "github.com/containers/libpod/cmd/podman/shared/parse" iopodman "github.com/containers/libpod/cmd/podman/varlink" "github.com/containers/libpod/libpod" "github.com/containers/libpod/libpod/define" "github.com/containers/libpod/libpod/logs" + envLib "github.com/containers/libpod/pkg/env" "github.com/containers/libpod/pkg/varlinkapi/virtwriter" "github.com/cri-o/ocicni/pkg/ocicni" "github.com/docker/docker/pkg/term" @@ -1025,16 +1025,11 @@ func (r *LocalRuntime) ExecContainer(ctx context.Context, cli *cliconfig.ExecVal ) // default invalid command exit code // Validate given environment variables - env := map[string]string{} - if err := parse.ReadKVStrings(env, []string{}, cli.Env); err != nil { - return -1, errors.Wrapf(err, "Exec unable to process environment variables") - } - - // Build env slice of key=value strings for Exec - envs := []string{} - for k, v := range env { - envs = append(envs, fmt.Sprintf("%s=%s", k, v)) + cliEnv, err := envLib.ParseSlice(cli.Env) + if err != nil { + return 0, errors.Wrap(err, "error parsing environment variables") } + envs := envLib.Slice(cliEnv) resize := make(chan remotecommand.TerminalSize, 5) haveTerminal := terminal.IsTerminal(int(os.Stdin.Fd())) |