[BUGFIX] output meshviewer-ffrgb export owner (#90)
This commit is contained in:
parent
bf2a026b89
commit
1acd8f4455
|
@ -33,6 +33,7 @@ type Node struct {
|
||||||
Network Network `json:"network"`
|
Network Network `json:"network"`
|
||||||
SiteCode string `json:"site_code,omitempty"`
|
SiteCode string `json:"site_code,omitempty"`
|
||||||
Hostname string `json:"hostname"`
|
Hostname string `json:"hostname"`
|
||||||
|
Owner string `json:"owner,omitempty"`
|
||||||
Location *Location `json:"location,omitempty"`
|
Location *Location `json:"location,omitempty"`
|
||||||
Firmware Firmware `json:"firmware,omitempty"`
|
Firmware Firmware `json:"firmware,omitempty"`
|
||||||
Autoupdater Autoupdater `json:"autoupdater"`
|
Autoupdater Autoupdater `json:"autoupdater"`
|
||||||
|
@ -93,6 +94,9 @@ func NewNode(nodes *runtime.Nodes, n *runtime.Node) *Node {
|
||||||
}
|
}
|
||||||
node.SiteCode = nodeinfo.System.SiteCode
|
node.SiteCode = nodeinfo.System.SiteCode
|
||||||
node.Hostname = nodeinfo.Hostname
|
node.Hostname = nodeinfo.Hostname
|
||||||
|
if owner := nodeinfo.Owner; owner != nil {
|
||||||
|
node.Owner = owner.Contact
|
||||||
|
}
|
||||||
if location := nodeinfo.Location; location != nil {
|
if location := nodeinfo.Location; location != nil {
|
||||||
node.Location = &Location{
|
node.Location = &Location{
|
||||||
Longtitude: location.Longtitude,
|
Longtitude: location.Longtitude,
|
||||||
|
|
|
@ -13,6 +13,9 @@ func TestRegister(t *testing.T) {
|
||||||
nodes := runtime.NewNodes(&runtime.Config{})
|
nodes := runtime.NewNodes(&runtime.Config{})
|
||||||
node := NewNode(nodes, &runtime.Node{
|
node := NewNode(nodes, &runtime.Node{
|
||||||
Nodeinfo: &data.NodeInfo{
|
Nodeinfo: &data.NodeInfo{
|
||||||
|
Owner: &data.Owner{
|
||||||
|
Contact: "whoami",
|
||||||
|
},
|
||||||
Network: data.Network{
|
Network: data.Network{
|
||||||
Mac: "blub",
|
Mac: "blub",
|
||||||
},
|
},
|
||||||
|
@ -43,6 +46,7 @@ func TestRegister(t *testing.T) {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
assert.NotNil(node)
|
assert.NotNil(node)
|
||||||
|
assert.Equal("whoami", node.Owner)
|
||||||
assert.Equal("blub", node.Network.MAC)
|
assert.Equal("blub", node.Network.MAC)
|
||||||
assert.Equal(13.3, node.Location.Longtitude)
|
assert.Equal(13.3, node.Location.Longtitude)
|
||||||
assert.Equal(8.7, node.Location.Latitude)
|
assert.Equal(8.7, node.Location.Latitude)
|
||||||
|
|
Loading…
Reference in New Issue