From b3638ac1ff00253e759f0c23c7864027510efedc Mon Sep 17 00:00:00 2001 From: Christian Goll Date: Wed, 21 Feb 2024 10:34:03 +0100 Subject: [PATCH 1/2] failing test for node list without network Signed-off-by: Christian Goll --- internal/app/wwctl/node/list/main_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/internal/app/wwctl/node/list/main_test.go b/internal/app/wwctl/node/list/main_test.go index 68c585d1..9a3f22ce 100644 --- a/internal/app/wwctl/node/list/main_test.go +++ b/internal/app/wwctl/node/list/main_test.go @@ -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-") From b387c86e6e1a15b3e42c36390d5dfe86e433cc72 Mon Sep 17 00:00:00 2001 From: Christian Goll Date: Wed, 21 Feb 2024 10:35:53 +0100 Subject: [PATCH 2/2] contruct network from nodeInfo not NodeConf Signed-off-by: Christian Goll --- CHANGELOG.md | 1 + internal/pkg/node/constructors.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 05f271f5..e5e78c2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/internal/pkg/node/constructors.go b/internal/pkg/node/constructors.go index 609a53ea..92dd506d 100644 --- a/internal/pkg/node/constructors.go +++ b/internal/pkg/node/constructors.go @@ -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)