Skip to content

Commit

Permalink
Add machine.Hostname
Browse files Browse the repository at this point in the history
  • Loading branch information
seanhoughtonatvi committed Mar 10, 2020
1 parent b9a02ff commit d544f7d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ type Machine interface {
SystemID() string
Hostname() string
FQDN() string
Owner() string
Tags() []string

OperatingSystem() string
Expand Down
9 changes: 9 additions & 0 deletions machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type machine struct {
systemID string
hostname string
fqdn string
owner string
tags []string
ownerData map[string]string

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()),

Expand Down Expand Up @@ -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"]),

Expand Down

0 comments on commit d544f7d

Please sign in to comment.