diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fa4c173..44d937a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Remove requisite dependency between ignition disk target and ignition service. #2083 - Return HTTP 409 status when creating an existing overlay - Allow whitespace to be trimmed for wwdoc comments. #2109 -- update go-chi to 5.2.5 to fix CVE-2025-69725 +- update go-chi to 5.2.5 to fix CVE-2025-69725 +- Prevented profile `comment` field from being inherited by nodes. #2078 ### Added diff --git a/internal/app/wwctl/node/list/main_test.go b/internal/app/wwctl/node/list/main_test.go index 808eb3e5..c3b0c086 100644 --- a/internal/app/wwctl/node/list/main_test.go +++ b/internal/app/wwctl/node/list/main_test.go @@ -157,7 +157,6 @@ nodes: NODE FIELD PROFILE VALUE ---- ----- ------- ----- n01 Profiles -- default -n01 Comment default profilecomment `, inDb: `nodeprofiles: default: @@ -173,10 +172,10 @@ nodes: args: []string{"-a"}, wantErr: false, stdout: ` -NODE FIELD PROFILE VALUE ----- ----- ------- ----- -n01 Profiles -- default -n01 Comment SUPERSEDED nodecomment +NODE FIELD PROFILE VALUE +---- ----- ------- ----- +n01 Profiles -- default +n01 Comment -- nodecomment `, inDb: `nodeprofiles: default: diff --git a/internal/pkg/node/mergo.go b/internal/pkg/node/mergo.go index 166b2c01..bd07a17b 100644 --- a/internal/pkg/node/mergo.go +++ b/internal/pkg/node/mergo.go @@ -168,6 +168,14 @@ func (config *NodesYaml) MergeNode(id string) (node Node, fields fieldMap, err e delete(fields, "Profiles") } + node.Comment = originalNode.Comment + if node.Comment != "" { + fields.Set("Comment", "", node.Comment) + fields["Comment"].Source = "" + } else { + delete(fields, "Comment") + } + node.setIds(id) node.valid = true node.updatePrimaryNetDev() diff --git a/internal/pkg/node/mergo_test.go b/internal/pkg/node/mergo_test.go index f95f8046..85bf0b3d 100644 --- a/internal/pkg/node/mergo_test.go +++ b/internal/pkg/node/mergo_test.go @@ -239,7 +239,7 @@ nodes: source: "", value: "n1 comment", }, - "profile comment": { + "profile comment not inherited": { nodesConf: ` nodes: n1: @@ -250,10 +250,10 @@ nodeprofiles: comment: p1 comment`, node: "n1", field: "Comment", - source: "p1", - value: "p1 comment", + source: "", + value: "", }, - "multiple profile comments": { + "multiple profile comments not inherited": { nodesConf: ` nodes: n1: @@ -267,10 +267,10 @@ nodeprofiles: comment: p2 comment`, node: "n1", field: "Comment", - source: "p2", - value: "p2 comment", + source: "", + value: "", }, - "node comment supersedes profile comment": { + "node comment with profile comment": { nodesConf: ` nodes: n1: @@ -282,10 +282,10 @@ nodeprofiles: comment: p1 comment`, node: "n1", field: "Comment", - source: "SUPERSEDED", + source: "", value: "n1 comment", }, - "node comment supersedes multiple profile comments": { + "node comment with multiple profile comments": { nodesConf: ` nodes: n1: @@ -300,10 +300,10 @@ nodeprofiles: comment: p2 comment`, node: "n1", field: "Comment", - source: "SUPERSEDED", + source: "", value: "n1 comment", }, - "nested profile comments": { + "nested profile comments not inherited": { nodesConf: ` nodes: n1: @@ -318,8 +318,8 @@ nodeprofiles: comment: p2 comment`, node: "n1", field: "Comment", - source: "p2", - value: "p2 comment", + source: "", + value: "", }, "node kernel args": { nodesConf: `