added backwards compatibilty for default

This commit is contained in:
Christian Goll
2022-05-12 11:51:00 +02:00
parent 9b6b93a5cb
commit 80c92475b0
2 changed files with 4 additions and 1 deletions

View File

@@ -167,7 +167,8 @@ func (config *nodeYaml) FindAllNodes() ([]NodeInfo, error) {
n.NetDevs[devname].Type.Set(netdev.Type)
n.NetDevs[devname].OnBoot.Set(netdev.OnBoot)
n.NetDevs[devname].Primary.Set(netdev.Primary)
// for just one netdev, it is always the default
n.NetDevs[devname].Primary.Set(netdev.Default) // backwards compatibility
// for just one netdev, it is always the primary
if len(node.NetDevs) == 1 {
n.NetDevs[devname].Primary.Set("true")
}
@@ -377,6 +378,7 @@ func (config *nodeYaml) FindAllProfiles() ([]NodeInfo, error) {
p.NetDevs[devname].Type.Set(netdev.Type)
p.NetDevs[devname].OnBoot.Set(netdev.OnBoot)
p.NetDevs[devname].Primary.Set(netdev.Primary)
p.NetDevs[devname].Primary.Set(netdev.Default) // backwards compatibility
// The following should not be set in a profile.
if netdev.Ipaddr != "" {

View File

@@ -76,6 +76,7 @@ type NetDevs struct {
Netmask string `yaml:"netmask,omitempty"`
Gateway string `yaml:"gateway,omitempty"`
Primary string `yaml:"primary,omitempty"`
Default string `yaml:"default,omitempty"` /* backward compatibility */
Tags map[string]string `yaml:"tags,omitempty"`
}