Don't populate NetDevs[].Type or NetDevs[].Netmask during upgrade
- Closes: #1661 NetDev defaults don't behave quite the same as standard fields, because they need to be set per-device. Meanwhile, trying to set a value may erroneously override values that are on the default profile. Switch this to a warning rather than attempting to take explicit action. Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
committed by
Christian Goll
parent
87b9ad33ff
commit
032db29f87
@@ -224,7 +224,15 @@ func (this *Node) Upgrade(addDefaults bool, replaceOverlays bool) (upgraded *nod
|
||||
}
|
||||
if this.NetDevs != nil {
|
||||
for name, netDev := range this.NetDevs {
|
||||
upgraded.NetDevs[name] = netDev.Upgrade(addDefaults)
|
||||
upgraded.NetDevs[name] = netDev.Upgrade(false)
|
||||
if addDefaults {
|
||||
if upgraded.NetDevs[name].Type == "" {
|
||||
wwlog.Warn("NetDevs[%s].Type not specified: verify default settings manually", name)
|
||||
}
|
||||
if len(upgraded.NetDevs[name].Netmask) == 0 {
|
||||
wwlog.Warn("NetDevs[%s].Netmask not specified: verify default settings manually", name)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if this.PrimaryNetDev != "" {
|
||||
@@ -630,7 +638,7 @@ func (this *NetDev) Upgrade(addDefaults bool) (upgraded *node.NetDev) {
|
||||
upgraded.Type = "ethernet"
|
||||
}
|
||||
if upgraded.Netmask == nil {
|
||||
upgraded.Netmask = net.ParseIP("255.255.255.0")
|
||||
upgraded.Netmask = net.IP{255, 255, 255, 0}
|
||||
}
|
||||
}
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user