summaryrefslogtreecommitdiff
path: root/pkg/spec/spec.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-04-03 01:02:57 +0200
committerGitHub <noreply@github.com>2020-04-03 01:02:57 +0200
commitccf0e0dd042d8a8d23dd0021ee267e7c9da9ff4a (patch)
treeee743630732dcad0828ef4880c3c706e50d62c18 /pkg/spec/spec.go
parentc3c6a7c8236fb43c3bc7172257b7fb15921e1668 (diff)
parent1f8569f7d768c411b5fed4446817c79b4b5337a0 (diff)
downloadpodman-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.go12
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)
}