summaryrefslogtreecommitdiff
path: root/pkg/specgen/generate/namespaces.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-01-06 15:26:55 -0500
committerGitHub <noreply@github.com>2021-01-06 15:26:55 -0500
commit8e4613ab0a57cf19f63d00a6426a9dee2489d3e6 (patch)
tree1a050d5573ae108b3693107b76c93b9562e73af2 /pkg/specgen/generate/namespaces.go
parent9198ed40e133fd2432ea1207008a02d4b70b99a1 (diff)
parent8f844a66d5d144eeb92870c27171dc8b35788d4f (diff)
downloadpodman-8e4613ab0a57cf19f63d00a6426a9dee2489d3e6.tar.gz
podman-8e4613ab0a57cf19f63d00a6426a9dee2489d3e6.tar.bz2
podman-8e4613ab0a57cf19f63d00a6426a9dee2489d3e6.zip
Merge pull request #8892 from mheon/fix_8886
Ensure that user-specified HOSTNAME is honored
Diffstat (limited to 'pkg/specgen/generate/namespaces.go')
-rw-r--r--pkg/specgen/generate/namespaces.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/pkg/specgen/generate/namespaces.go b/pkg/specgen/generate/namespaces.go
index 036c7b7a1..3cd5a3c9c 100644
--- a/pkg/specgen/generate/namespaces.go
+++ b/pkg/specgen/generate/namespaces.go
@@ -364,7 +364,9 @@ func specConfigureNamespaces(s *specgen.SpecGenerator, g *generate.Generator, rt
// namespaces?
g.SetHostname(hostname)
}
- g.AddProcessEnv("HOSTNAME", hostname)
+ if _, ok := s.Env["HOSTNAME"]; !ok && s.Hostname != "" {
+ g.AddProcessEnv("HOSTNAME", hostname)
+ }
// User
switch s.UserNS.NSMode {