Update nodes and profiles when renaming an image. #1637

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
Jonathon Anderson
2025-03-24 21:45:06 -06:00
parent 2d46a8b375
commit 605c910c82
3 changed files with 30 additions and 19 deletions

View File

@@ -16,6 +16,13 @@ import (
func Test_Rename(t *testing.T) {
env := testenv.New(t)
env.WriteFile(path.Join(testenv.WWChrootdir, "test-image/rootfs/file"), `test`)
env.WriteFile("etc/warewulf/nodes.conf", `
nodeprofiles:
default:
image name: test-image
nodes:
n1:
image name: test-image`)
defer env.RemoveAll()
warewulfd.SetNoDaemon()
@@ -38,6 +45,14 @@ func Test_Rename(t *testing.T) {
t.Run("Image list", func(t *testing.T) {
verifyImageListOutput(t, "test-image-rename")
})
assert.YAMLEq(t, `
nodeprofiles:
default:
image name: test-image-rename
nodes:
n1:
image name: test-image-rename`, env.ReadFile("etc/warewulf/nodes.conf"))
}
func verifyImageListOutput(t *testing.T, content string) {