Merge pull request #1095 from mslacken/Fix1094

Fix panic when node has no profile but network does
This commit is contained in:
Jonathon Anderson
2024-02-21 21:42:30 -07:00
committed by GitHub
3 changed files with 20 additions and 1 deletions

View File

@@ -70,6 +70,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Optionally detect network and netmask from CIDR IP address. #1016
- Fix startup of wwclient on systemd hosts #1066
- Change ownership of overlays to root:root #1086
- Fix panic when node has no profile but network does #1094
### Changed

View File

@@ -125,6 +125,24 @@ nodes:
- default
`,
},
{
name: "node list profile with network",
args: []string{},
wantErr: false,
stdout: ` NODE NAME PROFILES NETWORK
n01 default default
`,
inDb: `WW_INTERNAL: 45
nodeprofiles:
default:
network devices:
default:
device: eth0
nodes:
n01:
profiles:
- default
`},
}
conf_yml := `WW_INTERNAL: 0`
tempWarewulfConf, warewulfConfErr := os.CreateTemp("", "warewulf.conf-")

View File

@@ -205,7 +205,7 @@ func (config *NodeYaml) FindAllNodes() ([]NodeInfo, error) {
// set default/primary network is just one network exist
if len(n.NetDevs) >= 1 && !n.PrimaryNetDev.Defined() {
tmpNets := make([]string, 0, len(n.NetDevs))
for key := range node.NetDevs {
for key := range n.NetDevs {
tmpNets = append(tmpNets, key)
}
sort.Strings(tmpNets)