summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2018-02-22 14:51:48 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2018-02-23 04:25:47 +0000
commit16ed0baf65f5aa06530fcb3f8b0ccbdf309aedd1 (patch)
tree4ab24c4bb36a4ec20feab43ac290830220ba0c06
parenteafbe76ebee7fa2b2452078d7e9c938421e28f5e (diff)
downloadpodman-16ed0baf65f5aa06530fcb3f8b0ccbdf309aedd1.tar.gz
podman-16ed0baf65f5aa06530fcb3f8b0ccbdf309aedd1.tar.bz2
podman-16ed0baf65f5aa06530fcb3f8b0ccbdf309aedd1.zip
Move Hostname accessor to more logical place
Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #386 Approved by: baude
-rw-r--r--libpod/container.go27
1 files changed, 15 insertions, 12 deletions
diff --git a/libpod/container.go b/libpod/container.go
index 831e4e886..0e3b8b17f 100644
--- a/libpod/container.go
+++ b/libpod/container.go
@@ -466,6 +466,21 @@ func (c *Container) RuntimeName() string {
return c.runtime.ociRuntime.name
}
+// Runtime spec accessors
+// Unlocked
+
+// Hostname gets the container's hostname
+func (c *Container) Hostname() string {
+ if c.config.Spec.Hostname != "" {
+ return c.config.Spec.Hostname
+ }
+
+ if len(c.ID()) < 11 {
+ return c.ID()
+ }
+ return c.ID()[:12]
+}
+
// State Accessors
// Require locking
@@ -643,15 +658,3 @@ func (c *Container) RWSize() (int64, error) {
}
return c.rwSize()
}
-
-// Hostname gets the container's hostname
-func (c *Container) Hostname() string {
- if c.config.Spec.Hostname != "" {
- return c.config.Spec.Hostname
- }
-
- if len(c.ID()) < 11 {
- return c.ID()
- }
- return c.ID()[:12]
-}