From d544f7d72233f32d7f69988b1d55d8d34d751311 Mon Sep 17 00:00:00 2001 From: Sean Houghton Date: Tue, 10 Mar 2020 09:41:30 -0700 Subject: [PATCH] Add machine.Hostname --- interfaces.go | 1 + machine.go | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/interfaces.go b/interfaces.go index b42420b..4b3d0c4 100644 --- a/interfaces.go +++ b/interfaces.go @@ -219,6 +219,7 @@ type Machine interface { SystemID() string Hostname() string FQDN() string + Owner() string Tags() []string OperatingSystem() string diff --git a/machine.go b/machine.go index 11d922a..64be5c9 100644 --- a/machine.go +++ b/machine.go @@ -22,6 +22,7 @@ type machine struct { systemID string hostname string fqdn string + owner string tags []string ownerData map[string]string @@ -53,6 +54,7 @@ func (m *machine) updateFrom(other *machine) { m.systemID = other.systemID m.hostname = other.hostname m.fqdn = other.fqdn + m.owner = other.owner m.operatingSystem = other.operatingSystem m.distroSeries = other.distroSeries m.architecture = other.architecture @@ -83,6 +85,11 @@ func (m *machine) FQDN() string { return m.fqdn } +// Owner implements Machine. +func (m *machine) Owner() string { + return m.owner +} + // Tags implements Machine. func (m *machine) Tags() []string { return m.tags @@ -667,6 +674,7 @@ func machine_2_0(source map[string]interface{}) (*machine, error) { "system_id": schema.String(), "hostname": schema.String(), "fqdn": schema.String(), + "owner": schema.String(), "tag_names": schema.List(schema.String()), "owner_data": schema.StringMap(schema.String()), @@ -746,6 +754,7 @@ func machine_2_0(source map[string]interface{}) (*machine, error) { systemID: valid["system_id"].(string), hostname: valid["hostname"].(string), fqdn: valid["fqdn"].(string), + owner: valid["owner"].(string), tags: convertToStringSlice(valid["tag_names"]), ownerData: convertToStringMap(valid["owner_data"]),