mirror of
https://github.com/containers/podman.git
synced 2025-06-21 01:19:15 +08:00
Honor image environment variables with exec
Was reading the "env" argument twice instead of image. Closes #2063 Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
This commit is contained in:
@ -3,7 +3,6 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/containers/libpod/cmd/podman/libpodruntime"
|
"github.com/containers/libpod/cmd/podman/libpodruntime"
|
||||||
"github.com/containers/libpod/libpod"
|
"github.com/containers/libpod/libpod"
|
||||||
@ -99,15 +98,7 @@ func execCmd(c *cli.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ENVIRONMENT VARIABLES
|
// ENVIRONMENT VARIABLES
|
||||||
env := defaultEnvVariables
|
env := map[string]string{}
|
||||||
for _, e := range c.StringSlice("env") {
|
|
||||||
split := strings.SplitN(e, "=", 2)
|
|
||||||
if len(split) > 1 {
|
|
||||||
env[split[0]] = split[1]
|
|
||||||
} else {
|
|
||||||
env[split[0]] = ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := readKVStrings(env, []string{}, c.StringSlice("env")); err != nil {
|
if err := readKVStrings(env, []string{}, c.StringSlice("env")); err != nil {
|
||||||
return errors.Wrapf(err, "unable to process environment variables")
|
return errors.Wrapf(err, "unable to process environment variables")
|
||||||
|
Reference in New Issue
Block a user