summaryrefslogtreecommitdiff
path: root/libpod/pod.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@pm.me>2020-06-04 16:32:10 -0400
committerMatthew Heon <matthew.heon@pm.me>2020-06-04 16:32:10 -0400
commit644a7b78ff1d2ee7805d8ddc105827b421ec598d (patch)
treeee50174235ecab7ed5be1e81d8a88e7cf370468a /libpod/pod.go
parentb0578963aaf83e4c5686b957fd09c9311eac35c6 (diff)
downloadpodman-644a7b78ff1d2ee7805d8ddc105827b421ec598d.tar.gz
podman-644a7b78ff1d2ee7805d8ddc105827b421ec598d.tar.bz2
podman-644a7b78ff1d2ee7805d8ddc105827b421ec598d.zip
Ensure that containers in pods properly set hostname
When we moved to the new Namespace types in Specgen, we made a distinction between taking a namespace from a pod, and taking it from another container. Due to this new distinction, some code that previously worked for both `--pod=$ID` and `--uts=container:$ID` has accidentally become conditional on only the latter case. This happened for Hostname - we weren't properly setting it in cases where the container joined a pod. Fortunately, this is an easy fix once we know to check the condition. Also, ensure that `podman pod inspect` actually prints hostname. Fixes #6494 Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'libpod/pod.go')
-rw-r--r--libpod/pod.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/libpod/pod.go b/libpod/pod.go
index 34ceef5ef..8afaa6052 100644
--- a/libpod/pod.go
+++ b/libpod/pod.go
@@ -171,6 +171,11 @@ func (p *Pod) SharesCgroup() bool {
return p.config.UsePodCgroupNS
}
+// Hostname returns the hostname of the pod.
+func (p *Pod) Hostname() string {
+ return p.config.Hostname
+}
+
// CgroupPath returns the path to the pod's CGroup
func (p *Pod) CgroupPath() (string, error) {
p.lock.Lock()