Adjusting profile comment field so that it's not inherited by nodes

This commit is contained in:
jason scott
2026-02-23 14:31:07 -07:00
parent 76469e7f96
commit 8397947d3d
4 changed files with 27 additions and 19 deletions

View File

@@ -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 - Remove requisite dependency between ignition disk target and ignition service. #2083
- Return HTTP 409 status when creating an existing overlay - Return HTTP 409 status when creating an existing overlay
- Allow whitespace to be trimmed for wwdoc comments. #2109 - 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 ### Added

View File

@@ -157,7 +157,6 @@ nodes:
NODE FIELD PROFILE VALUE NODE FIELD PROFILE VALUE
---- ----- ------- ----- ---- ----- ------- -----
n01 Profiles -- default n01 Profiles -- default
n01 Comment default profilecomment
`, `,
inDb: `nodeprofiles: inDb: `nodeprofiles:
default: default:
@@ -173,10 +172,10 @@ nodes:
args: []string{"-a"}, args: []string{"-a"},
wantErr: false, wantErr: false,
stdout: ` stdout: `
NODE FIELD PROFILE VALUE NODE FIELD PROFILE VALUE
---- ----- ------- ----- ---- ----- ------- -----
n01 Profiles -- default n01 Profiles -- default
n01 Comment SUPERSEDED nodecomment n01 Comment -- nodecomment
`, `,
inDb: `nodeprofiles: inDb: `nodeprofiles:
default: default:

View File

@@ -168,6 +168,14 @@ func (config *NodesYaml) MergeNode(id string) (node Node, fields fieldMap, err e
delete(fields, "Profiles") 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.setIds(id)
node.valid = true node.valid = true
node.updatePrimaryNetDev() node.updatePrimaryNetDev()

View File

@@ -239,7 +239,7 @@ nodes:
source: "", source: "",
value: "n1 comment", value: "n1 comment",
}, },
"profile comment": { "profile comment not inherited": {
nodesConf: ` nodesConf: `
nodes: nodes:
n1: n1:
@@ -250,10 +250,10 @@ nodeprofiles:
comment: p1 comment`, comment: p1 comment`,
node: "n1", node: "n1",
field: "Comment", field: "Comment",
source: "p1", source: "",
value: "p1 comment", value: "",
}, },
"multiple profile comments": { "multiple profile comments not inherited": {
nodesConf: ` nodesConf: `
nodes: nodes:
n1: n1:
@@ -267,10 +267,10 @@ nodeprofiles:
comment: p2 comment`, comment: p2 comment`,
node: "n1", node: "n1",
field: "Comment", field: "Comment",
source: "p2", source: "",
value: "p2 comment", value: "",
}, },
"node comment supersedes profile comment": { "node comment with profile comment": {
nodesConf: ` nodesConf: `
nodes: nodes:
n1: n1:
@@ -282,10 +282,10 @@ nodeprofiles:
comment: p1 comment`, comment: p1 comment`,
node: "n1", node: "n1",
field: "Comment", field: "Comment",
source: "SUPERSEDED", source: "",
value: "n1 comment", value: "n1 comment",
}, },
"node comment supersedes multiple profile comments": { "node comment with multiple profile comments": {
nodesConf: ` nodesConf: `
nodes: nodes:
n1: n1:
@@ -300,10 +300,10 @@ nodeprofiles:
comment: p2 comment`, comment: p2 comment`,
node: "n1", node: "n1",
field: "Comment", field: "Comment",
source: "SUPERSEDED", source: "",
value: "n1 comment", value: "n1 comment",
}, },
"nested profile comments": { "nested profile comments not inherited": {
nodesConf: ` nodesConf: `
nodes: nodes:
n1: n1:
@@ -318,8 +318,8 @@ nodeprofiles:
comment: p2 comment`, comment: p2 comment`,
node: "n1", node: "n1",
field: "Comment", field: "Comment",
source: "p2", source: "",
value: "p2 comment", value: "",
}, },
"node kernel args": { "node kernel args": {
nodesConf: ` nodesConf: `