diff options
author | baude <bbaude@redhat.com> | 2019-03-08 10:32:33 -0600 |
---|---|---|
committer | baude <bbaude@redhat.com> | 2019-03-08 10:32:33 -0600 |
commit | 24f567a3db68efe67273b63cd50a003f0b6c5621 (patch) | |
tree | 29c1199279c6afb708dd3e849fddbd8aa5844a2b | |
parent | 8c54126b6f60d216350cda29a5a5ed8b216854fe (diff) | |
download | podman-24f567a3db68efe67273b63cd50a003f0b6c5621.tar.gz podman-24f567a3db68efe67273b63cd50a003f0b6c5621.tar.bz2 podman-24f567a3db68efe67273b63cd50a003f0b6c5621.zip |
container runlabel respect $PWD
When doing environment variable substitution, we need to make sure
$PWD is replaced with the current working directory.
fixes issue #2171
Signed-off-by: baude <bbaude@redhat.com>
-rw-r--r-- | cmd/podman/shared/container.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/cmd/podman/shared/container.go b/cmd/podman/shared/container.go index 81811e0f2..e191e8069 100644 --- a/cmd/podman/shared/container.go +++ b/cmd/podman/shared/container.go @@ -665,6 +665,14 @@ func GenerateRunlabelCommand(runLabel, imageName, name string, opts map[string]s return envmap["OPT2"] case "OPT3": return envmap["OPT3"] + case "PWD": + // I would prefer to use os.getenv but it appears PWD is not in the os env list + d, err := os.Getwd() + if err != nil { + logrus.Error("unable to determine current working directory") + return "" + } + return d } return "" } |