Add recursive getter functions
When transforming a NodeConf struct to a NodeInfo (get the NodeInfo from the Nodconf) nested structures were seperately handled. This means there were seperate handles for e.g *Netdevs and *IpmiConfig. The new getter traverses through the datastucture and sets the right value for an Entry struct, but calls itself again if a Pointer is detected. This adds the posiblity to add new nested structures to NodeConf and NodeInfo without the need of seperate handling them in the transformer functions. Signed-off-by: Christian Goll <cgoll@suse.de>
This commit is contained in:
committed by
Jonathon Anderson
parent
f2bc70ad00
commit
fdd233a25f
@@ -299,13 +299,14 @@ ipmi: {}
|
||||
t.Errorf("Got wrong yml, wanted:\n'%s'\nGot:\n'%s'", wanted, string(ymlByte))
|
||||
}
|
||||
delete(test_node4.Tags, "foo")
|
||||
nodeConf = NewConf()
|
||||
nodeConf.GetFrom(test_node4)
|
||||
nodeConf.Flatten()
|
||||
ymlByte, _ = yaml.Marshal(nodeConf)
|
||||
wanted = `{}
|
||||
`
|
||||
if string(ymlByte) != wanted {
|
||||
t.Errorf("Couldn't remove tag'%s'", string(ymlByte))
|
||||
t.Errorf("Couldn't remove tag, wanted:\n%s\nGot:\n%s", wanted, string(ymlByte))
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user