diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-04-03 01:02:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-03 01:02:57 +0200 |
commit | ccf0e0dd042d8a8d23dd0021ee267e7c9da9ff4a (patch) | |
tree | ee743630732dcad0828ef4880c3c706e50d62c18 /pkg/spec/spec.go | |
parent | c3c6a7c8236fb43c3bc7172257b7fb15921e1668 (diff) | |
parent | 1f8569f7d768c411b5fed4446817c79b4b5337a0 (diff) | |
download | podman-ccf0e0dd042d8a8d23dd0021ee267e7c9da9ff4a.tar.gz podman-ccf0e0dd042d8a8d23dd0021ee267e7c9da9ff4a.tar.bz2 podman-ccf0e0dd042d8a8d23dd0021ee267e7c9da9ff4a.zip |
Merge pull request #5696 from rhatdan/cc
Fix environment handling from containers.conf
Diffstat (limited to 'pkg/spec/spec.go')
-rw-r--r-- | pkg/spec/spec.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/pkg/spec/spec.go b/pkg/spec/spec.go index d4fd5976f..4732af757 100644 --- a/pkg/spec/spec.go +++ b/pkg/spec/spec.go @@ -316,7 +316,17 @@ func (config *CreateConfig) createConfigToOCISpec(runtime *libpod.Runtime, userM // Make sure to always set the default variables unless overridden in the // config. - config.Env = env.Join(env.DefaultEnvVariables, config.Env) + var defaultEnv map[string]string + if runtimeConfig == nil { + defaultEnv = env.DefaultEnvVariables + } else { + defaultEnv, err = env.ParseSlice(runtimeConfig.Containers.Env) + if err != nil { + return nil, errors.Wrap(err, "Env fields in containers.conf failed ot parse") + } + defaultEnv = env.Join(env.DefaultEnvVariables, defaultEnv) + } + config.Env = env.Join(defaultEnv, config.Env) for name, val := range config.Env { g.AddProcessEnv(name, val) } |