From 5f924dcb00a669bbb591ef6c015dd0db248bcbe0 Mon Sep 17 00:00:00 2001 From: Alejandro Mery Date: Mon, 21 Aug 2023 22:02:16 +0000 Subject: [PATCH] zones: introduce Machine.FullName() Signed-off-by: Alejandro Mery --- pkg/zones/machine.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pkg/zones/machine.go b/pkg/zones/machine.go index acefd7d..c238857 100644 --- a/pkg/zones/machine.go +++ b/pkg/zones/machine.go @@ -2,6 +2,7 @@ package zones import ( "strconv" + "strings" "sync" ) @@ -38,3 +39,17 @@ func (m *Machine) ID() int { return m.id } + +// FullName returns the Name of the machine including domain name +func (m *Machine) FullName() string { + if domain := m.zone.zones.domain; domain != "" { + var s = []string{ + m.Name, + domain, + } + + return strings.Join(s, ".") + } + + return m.Name +}