Move Hostname accessor to more logical place
Closes:
Approved by: baude
@@ -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]
-}
