Refactor spec generation in libpod into a function

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #386
Approved by: baude
This commit is contained in:
Matthew Heon
2018-02-22 14:49:35 -05:00
committed by Atomic Bot
parent 8eadc208e1
commit eafbe76ebe
3 changed files with 193 additions and 230 deletions

View File

@ -643,3 +643,15 @@ 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]
}