[BUGFIX] output meshviewer-ffrgb export owner (#90)

This commit is contained in:
Geno 2017-11-03 14:05:52 +01:00 committed by Martin Geno
parent bf2a026b89
commit 1acd8f4455
No known key found for this signature in database
GPG Key ID: F0D39A37E925E941
2 changed files with 8 additions and 0 deletions

View File

@ -33,6 +33,7 @@ type Node struct {
Network Network `json:"network"`
SiteCode string `json:"site_code,omitempty"`
Hostname string `json:"hostname"`
Owner string `json:"owner,omitempty"`
Location *Location `json:"location,omitempty"`
Firmware Firmware `json:"firmware,omitempty"`
Autoupdater Autoupdater `json:"autoupdater"`
@ -93,6 +94,9 @@ func NewNode(nodes *runtime.Nodes, n *runtime.Node) *Node {
}
node.SiteCode = nodeinfo.System.SiteCode
node.Hostname = nodeinfo.Hostname
if owner := nodeinfo.Owner; owner != nil {
node.Owner = owner.Contact
}
if location := nodeinfo.Location; location != nil {
node.Location = &Location{
Longtitude: location.Longtitude,

View File

@ -13,6 +13,9 @@ func TestRegister(t *testing.T) {
nodes := runtime.NewNodes(&runtime.Config{})
node := NewNode(nodes, &runtime.Node{
Nodeinfo: &data.NodeInfo{
Owner: &data.Owner{
Contact: "whoami",
},
Network: data.Network{
Mac: "blub",
},
@ -43,6 +46,7 @@ func TestRegister(t *testing.T) {
},
})
assert.NotNil(node)
assert.Equal("whoami", node.Owner)
assert.Equal("blub", node.Network.MAC)
assert.Equal(13.3, node.Location.Longtitude)
assert.Equal(8.7, node.Location.Latitude)