From 7e742b0d8aa2c44fe78d38006673220bc9008f00 Mon Sep 17 00:00:00 2001 From: Jonathon Anderson Date: Fri, 27 Dec 2024 05:58:46 -0700 Subject: [PATCH] Fix DelProfile to operate on profiles, not nodes. - Fixes: #1622 Signed-off-by: Jonathon Anderson --- CHANGELOG.md | 1 + internal/pkg/node/modifiers.go | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dbb1c831..dc21fa93 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -133,6 +133,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Allow iPXE to continue booting without runtime overlay. #806 - Format errors in logs as strings. #1563 - Fix display of profiles during node list. #1496 +- Fix internal DelProfile function to correctly operate on profiles rather than nodes. #1622 ## v4.5.8, 2024-10-01 diff --git a/internal/pkg/node/modifiers.go b/internal/pkg/node/modifiers.go index e20d3ccb..be9554aa 100644 --- a/internal/pkg/node/modifiers.go +++ b/internal/pkg/node/modifiers.go @@ -93,15 +93,15 @@ func (config *NodesYaml) AddProfile(profileId string) (*Profile, error) { } /* -delete node with the given id +delete profile with the given id */ -func (config *NodesYaml) DelProfile(nodeID string) error { - if _, ok := config.Nodes[nodeID]; !ok { - return errors.New("profile does not exist: " + nodeID) +func (config *NodesYaml) DelProfile(profileID string) error { + if _, ok := config.NodeProfiles[profileID]; !ok { + return errors.New("profile does not exist: " + profileID) } - wwlog.Verbose("deleting profile: %s", nodeID) - delete(config.Nodes, nodeID) + wwlog.Verbose("deleting profile: %s", profileID) + delete(config.NodeProfiles, profileID) return nil }