Merge pull request #1524 from anderbubble/refactor-node-and-upgrade

Support cross-version upgrades
This commit is contained in:
Christian Goll
2024-11-11 10:45:47 +01:00
committed by GitHub
119 changed files with 2708 additions and 930 deletions

View File

@@ -23,8 +23,7 @@ func Test_Add(t *testing.T) {
args: []string{"n01"},
wantErr: false,
stdout: "",
outDb: `WW_INTERNAL: 45
nodeprofiles: {}
outDb: `nodeprofiles: {}
nodes:
n01:
profiles:
@@ -34,8 +33,7 @@ nodes:
args: []string{"--profile=foo", "n01"},
wantErr: false,
stdout: "",
outDb: `WW_INTERNAL: 45
nodeprofiles: {}
outDb: `nodeprofiles: {}
nodes:
n01:
profiles:
@@ -45,8 +43,7 @@ nodes:
args: []string{"--discoverable=true", "n01"},
wantErr: false,
stdout: "",
outDb: `WW_INTERNAL: 45
nodeprofiles: {}
outDb: `nodeprofiles: {}
nodes:
n01:
discoverable: "true"
@@ -57,8 +54,7 @@ nodes:
args: []string{"--discoverable", "n01"},
wantErr: false,
stdout: "",
outDb: `WW_INTERNAL: 45
nodeprofiles: {}
outDb: `nodeprofiles: {}
nodes:
n01:
discoverable: "true"
@@ -70,16 +66,14 @@ nodes:
wantErr: true,
stdout: "",
chkout: false,
outDb: `WW_INTERNAL: 45
nodeprofiles: {}
outDb: `nodeprofiles: {}
nodes: {}
`},
{name: "single node add, discoverable false",
args: []string{"--discoverable=false", "n01"},
wantErr: false,
stdout: "",
outDb: `WW_INTERNAL: 45
nodeprofiles: {}
outDb: `nodeprofiles: {}
nodes:
n01:
discoverable: "false"
@@ -90,8 +84,7 @@ nodes:
args: []string{"--kernelargs=foo", "n01"},
wantErr: false,
stdout: "",
outDb: `WW_INTERNAL: 45
nodeprofiles: {}
outDb: `nodeprofiles: {}
nodes:
n01:
kernel:
@@ -103,8 +96,7 @@ nodes:
args: []string{"n01", "n02"},
wantErr: false,
stdout: "",
outDb: `WW_INTERNAL: 45
nodeprofiles: {}
outDb: `nodeprofiles: {}
nodes:
n01:
profiles:
@@ -117,8 +109,7 @@ nodes:
args: []string{"--ipaddr6=fdaa::1", "n01"},
wantErr: false,
stdout: "",
outDb: `WW_INTERNAL: 45
nodeprofiles: {}
outDb: `nodeprofiles: {}
nodes:
n01:
profiles:
@@ -131,8 +122,7 @@ nodes:
args: []string{"--ipaddr=10.0.0.1", "n01"},
wantErr: false,
stdout: "",
outDb: `WW_INTERNAL: 45
nodeprofiles: {}
outDb: `nodeprofiles: {}
nodes:
n01:
profiles:
@@ -146,16 +136,14 @@ nodes:
wantErr: true,
stdout: "",
chkout: false,
outDb: `WW_INTERNAL: 45
nodeprofiles: {}
outDb: `nodeprofiles: {}
nodes: {}
`},
{name: "three nodes with ipaddr",
args: []string{"--ipaddr=10.10.0.1", "n[01-02,03]"},
wantErr: false,
stdout: "",
outDb: `WW_INTERNAL: 45
nodeprofiles: {}
outDb: `nodeprofiles: {}
nodes:
n01:
profiles:
@@ -180,8 +168,7 @@ nodes:
args: []string{"--ipaddr=10.10.0.1", "--netname=foo", "n[01-03]"},
wantErr: false,
stdout: "",
outDb: `WW_INTERNAL: 45
nodeprofiles: {}
outDb: `nodeprofiles: {}
nodes:
n01:
profiles:
@@ -206,8 +193,7 @@ nodes:
args: []string{"--ipaddr=10.10.0.1", "--netname=foo", "--ipmiaddr=10.20.0.1", "n[01-03]"},
wantErr: false,
stdout: "",
outDb: `WW_INTERNAL: 45
nodeprofiles: {}
outDb: `nodeprofiles: {}
nodes:
n01:
ipmi:
@@ -238,8 +224,7 @@ nodes:
args: []string{"--fsname=/dev/vda1", "--fspath=/var", "n01"},
wantErr: false,
stdout: "",
outDb: `WW_INTERNAL: 45
nodeprofiles: {}
outDb: `nodeprofiles: {}
nodes:
n01:
profiles:
@@ -252,16 +237,14 @@ nodes:
args: []string{"--fsname=dev/vda1", "--fspath=/var", "n01"},
wantErr: true,
stdout: "",
outDb: `WW_INTERNAL: 45
nodeprofiles: {}
outDb: `nodeprofiles: {}
nodes: {}
`},
{name: "one node with filesystem and partition ",
args: []string{"--fsname=var", "--fspath=/var", "--partname=var", "--diskname=/dev/vda", "--partnumber=1", "n01"},
wantErr: false,
stdout: "",
outDb: `WW_INTERNAL: 45
nodeprofiles: {}
outDb: `nodeprofiles: {}
nodes:
n01:
profiles:
@@ -279,8 +262,7 @@ nodes:
args: []string{"--fsname=var", "--fspath=/var", "--fsformat=btrfs", "--partname=var", "--diskname=/dev/vda", "--partnumber=1", "n01"},
wantErr: false,
stdout: "",
outDb: `WW_INTERNAL: 45
nodeprofiles: {}
outDb: `nodeprofiles: {}
nodes:
n01:
profiles:
@@ -299,8 +281,7 @@ nodes:
warewulfd.SetNoDaemon()
for _, tt := range tests {
env := testenv.New(t)
env.WriteFile(t, "etc/warewulf/nodes.conf",
`WW_INTERNAL: 45`)
env.WriteFile(t, "etc/warewulf/nodes.conf", ``)
var err error
t.Run(tt.name, func(t *testing.T) {
baseCmd := GetCommand()

View File

@@ -12,7 +12,7 @@ import (
// Holds the variables which are needed in CobraRunE
type variables struct {
nodeConf node.NodeConf
nodeConf node.Node
nodeAdd node.NodeConfAdd
}

View File

@@ -18,7 +18,7 @@ func CobraRunE(cmd *cobra.Command, args []string) (err error) {
}
if !SetYes {
var nodeList []node.NodeConf
var nodeList []node.Node
// The checks run twice in the prompt case.
// Avoiding putting in a blocking prompt in an API.
nodeList, err = apiNode.NodeDeleteParameterCheck(&ndp, false)

View File

@@ -38,7 +38,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
Output: args,
}
nodeListMsg := apinode.FilteredNodes(&filterList)
nodeMap := make(map[string]*node.NodeConf)
nodeMap := make(map[string]*node.Node)
// got proper yaml back
_ = yaml.Unmarshal([]byte(nodeListMsg.NodeConfMapYaml), nodeMap)
file, err := os.CreateTemp(os.TempDir(), "ww4NodeEdit*.yaml")
@@ -50,7 +50,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
_ = file.Truncate(0)
_, _ = file.Seek(0, 0)
if !NoHeader {
yamlTemplate := node.UnmarshalConf(node.NodeConf{}, []string{"tagsdel"})
yamlTemplate := node.UnmarshalConf(node.Node{}, []string{"tagsdel"})
_, _ = file.WriteString("#nodename:\n# " + strings.Join(yamlTemplate, "\n# ") + "\n")
}
_, _ = file.WriteString(nodeListMsg.NodeConfMapYaml)
@@ -73,7 +73,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
wwlog.Debug("Hashes are before %s and after %s\n", sum1, sum2)
if sum1 != sum2 {
wwlog.Debug("Nodes were modified")
modifiedNodeMap := make(map[string]*node.NodeConf)
modifiedNodeMap := make(map[string]*node.Node)
_, _ = file.Seek(0, 0)
// ignore error as only may occurs under strange circumstances
buffer, _ := io.ReadAll(file)

View File

@@ -22,7 +22,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
}
defer file.Close()
importMap := make(map[string]*node.NodeConf)
importMap := make(map[string]*node.Node)
buffer, err := io.ReadAll(file)
if err != nil {
return fmt.Errorf("could not read: %s", err)
@@ -64,7 +64,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
continue
}
if importMap[line[0]] == nil {
importMap[line[0]] = new(node.NodeConf)
importMap[line[0]] = new(node.Node)
}
}
}

View File

@@ -32,8 +32,7 @@ NODE NAME PROFILES NETWORK
--------- -------- -------
n01 [default] --
`,
inDb: `WW_INTERNAL: 45
nodeprofiles:
inDb: `nodeprofiles:
default: {}
nodes:
n01:
@@ -51,8 +50,7 @@ NODE NAME PROFILES NETWORK
n01 [default] --
n02 [default] --
`,
inDb: `WW_INTERNAL: 45
nodeprofiles:
inDb: `nodeprofiles:
default: {}
nodes:
n01:
@@ -73,8 +71,7 @@ NODE NAME PROFILES NETWORK
n01 [default] --
n02 [default] --
`,
inDb: `WW_INTERNAL: 45
nodeprofiles:
inDb: `nodeprofiles:
default: {}
nodes:
n01:
@@ -95,8 +92,7 @@ NODE NAME PROFILES NETWORK
n01 [default] --
n03 [default] --
`,
inDb: `WW_INTERNAL: 45
nodeprofiles:
inDb: `nodeprofiles:
default: {}
nodes:
n01:
@@ -125,8 +121,7 @@ NODE NAME PROFILES NETWORK
--------- -------- -------
n01 [default] --
`,
inDb: `WW_INTERNAL: 45
nodeprofiles:
inDb: `nodeprofiles:
default: {}
nodes:
n01:
@@ -146,8 +141,7 @@ NODE NAME PROFILES NETWORK
--------- -------- -------
n01 [default] default
`,
inDb: `WW_INTERNAL: 45
nodeprofiles:
inDb: `nodeprofiles:
default:
network devices:
default:
@@ -168,8 +162,7 @@ NODE FIELD PROFILE VALUE
n01 Comment default profilecomment
n01 Profiles -- default
`,
inDb: `WW_INTERNAL: 45
nodeprofiles:
inDb: `nodeprofiles:
default:
comment: profilecomment
nodes:
@@ -188,8 +181,7 @@ NODE FIELD PROFILE VALUE
n01 Comment SUPERSEDED nodecomment
n01 Profiles -- default
`,
inDb: `WW_INTERNAL: 45
nodeprofiles:
inDb: `nodeprofiles:
default:
comment: profilecomment
nodes:
@@ -208,8 +200,7 @@ NODE IPMI IPADDR IPMI PORT IPMI USERNAME IPMI INTERFACE
---- ----------- --------- ------------- --------------
n01 <nil> -- admin --
`,
inDb: `WW_INTERNAL: 45
nodeprofiles:
inDb: `nodeprofiles:
default:
ipmi:
username: admin
@@ -228,8 +219,7 @@ NODE IPMI IPADDR IPMI PORT IPMI USERNAME IPMI INTERFACE
---- ----------- --------- ------------- --------------
n01 <nil> -- user --
`,
inDb: `WW_INTERNAL: 45
nodeprofiles:
inDb: `nodeprofiles:
default:
ipmi:
username: admin
@@ -250,8 +240,7 @@ NODE NAME PROFILES NETWORK
--------- -------- -------
n01 [p1 p2] --
`,
inDb: `WW_INTERNAL: 45
nodeprofiles:
inDb: `nodeprofiles:
p1: {}
p2: {}
nodes:
@@ -270,8 +259,7 @@ NODE FIELD PROFILE VALUE
---- ----- ------- -----
n01 Profiles -- p1,p2
`,
inDb: `WW_INTERNAL: 45
nodeprofiles:
inDb: `nodeprofiles:
p1: {}
p2: {}
nodes:
@@ -290,8 +278,7 @@ NODE NAME KERNEL OVERRIDE CONTAINER OVERLAYS (S/R)
--------- --------------- --------- --------------
n01 -- -- /rop1,rop2
`,
inDb: `WW_INTERNAL: 45
nodeprofiles:
inDb: `nodeprofiles:
p1:
runtime overlay:
- rop1
@@ -311,8 +298,7 @@ NODE NAME KERNEL OVERRIDE CONTAINER OVERLAYS (S/R)
--------- --------------- --------- --------------
n01 -- -- sop1/nop1,~rop1,rop1,rop2
`,
inDb: `WW_INTERNAL: 45
nodeprofiles:
inDb: `nodeprofiles:
p1:
system overlay:
- sop1
@@ -339,8 +325,7 @@ n01 Profiles -- p1
n01 RuntimeOverlay p1+ nop1,~rop1,rop1,rop2
n01 SystemOverlay p1 sop1
`,
inDb: `WW_INTERNAL: 45
nodeprofiles:
inDb: `nodeprofiles:
p1:
system overlay:
- sop1
@@ -366,8 +351,7 @@ NODE FIELD PROFILE VALUE
n01 Profiles -- p1
n01 RuntimeOverlay p1+ nop1,rop1,rop2
`,
inDb: `WW_INTERNAL: 45
nodeprofiles:
inDb: `nodeprofiles:
p1:
runtime overlay:
- rop1
@@ -389,8 +373,7 @@ NODE FIELD PROFILE VALUE
---- ----- ------- -----
n1 NetDevs[default].OnBoot -- true
`,
inDb: `WW_INTERNAL: 45
nodes:
inDb: `nodes:
n1:
network devices:
default:
@@ -405,8 +388,7 @@ nodes:
NODE FIELD PROFILE VALUE
---- ----- ------- -----
`,
inDb: `WW_INTERNAL: 46
nodes:
inDb: `nodes:
wwnode1:
network devices:
default: {}
@@ -414,7 +396,7 @@ nodes:
},
}
conf_yml := `WW_INTERNAL: 0`
conf_yml := ``
tempWarewulfConf, warewulfConfErr := os.CreateTemp("", "warewulf.conf-")
assert.NoError(t, warewulfConfErr)
defer os.Remove(tempWarewulfConf.Name())
@@ -470,7 +452,7 @@ func TestListMultipleFormats(t *testing.T) {
kernel: {}
ipmi: {}
`,
inDb: `WW_INTERNAL: 43
inDb: `
nodeprofiles:
default: {}
nodes:
@@ -520,7 +502,7 @@ nodes:
}
]
`,
inDb: `WW_INTERNAL: 43
inDb: `
nodeprofiles:
default: {}
nodes:
@@ -604,7 +586,7 @@ nodes:
}
]
`,
inDb: `WW_INTERNAL: 43
inDb: `
nodeprofiles:
default: {}
nodes:
@@ -629,7 +611,7 @@ nodes:
kernel: {}
ipmi: {}
`,
inDb: `WW_INTERNAL: 43
inDb: `
nodeprofiles:
default: {}
nodes:

View File

@@ -15,7 +15,7 @@ func Test_Sensors(t *testing.T) {
warewulfd.SetNoDaemon()
env := testenv.New(t)
defer env.RemoveAll(t)
env.WriteFile(t, "etc/warewulf/nodes.conf", `WW_INTERNAL: 43
env.WriteFile(t, "etc/warewulf/nodes.conf", `
nodeprofiles:
default:
ipmi:

View File

@@ -56,16 +56,14 @@ func Test_Single_Node_Change_Profile(t *testing.T) {
args: []string{"--profile=foo", "n01"},
wantErr: false,
stdout: "",
inDB: `WW_INTERNAL: 45
nodeprofiles:
inDB: `nodeprofiles:
default:
comment: testit
nodes:
n01:
profiles:
- default`,
outDb: `WW_INTERNAL: 45
nodeprofiles:
outDb: `nodeprofiles:
default:
comment: testit
nodes:
@@ -82,15 +80,13 @@ func Test_Node_Unset(t *testing.T) {
args: []string{"--comment=UNDEF", "n01"},
wantErr: false,
stdout: "",
inDB: `WW_INTERNAL: 43
nodeprofiles: {}
inDB: `nodeprofiles: {}
nodes:
n01:
comment: foo
profiles:
- default`,
outDb: `WW_INTERNAL: 43
nodeprofiles: {}
outDb: `nodeprofiles: {}
nodes:
n01:
profiles:
@@ -105,13 +101,11 @@ func Test_Set_Ipmi_Write_Explicit(t *testing.T) {
args: []string{"--ipmiwrite", "true", "n01"},
wantErr: false,
stdout: "",
inDB: `WW_INTERNAL: 43
nodeprofiles: {}
inDB: `nodeprofiles: {}
nodes:
n01: {}
`,
outDb: `WW_INTERNAL: 43
nodeprofiles: {}
outDb: `nodeprofiles: {}
nodes:
n01:
ipmi:
@@ -126,13 +120,11 @@ func Test_Set_Ipmi_Write_Implicit(t *testing.T) {
args: []string{"--ipmiwrite", "n01"},
wantErr: false,
stdout: "",
inDB: `WW_INTERNAL: 43
nodeprofiles: {}
inDB: `nodeprofiles: {}
nodes:
n01: {}
`,
outDb: `WW_INTERNAL: 43
nodeprofiles: {}
outDb: `nodeprofiles: {}
nodes:
n01:
ipmi:
@@ -147,15 +139,13 @@ func Test_Unset_Ipmi_Write(t *testing.T) {
args: []string{"--ipmiwrite=UNDEF", "n01"},
wantErr: false,
stdout: "",
inDB: `WW_INTERNAL: 43
nodeprofiles: {}
inDB: `nodeprofiles: {}
nodes:
n01:
ipmi:
write: "true"
`,
outDb: `WW_INTERNAL: 43
nodeprofiles: {}
outDb: `nodeprofiles: {}
nodes:
n01: {}
`,
@@ -168,15 +158,13 @@ func Test_Unset_Ipmi_Write_False(t *testing.T) {
args: []string{"--ipmiwrite=UNDEF", "n01"},
wantErr: false,
stdout: "",
inDB: `WW_INTERNAL: 43
nodeprofiles: {}
inDB: `nodeprofiles: {}
nodes:
n01:
ipmi:
write: "false"
`,
outDb: `WW_INTERNAL: 43
nodeprofiles: {}
outDb: `nodeprofiles: {}
nodes:
n01: {}
`,
@@ -189,8 +177,7 @@ func Test_Ipmi_Hidden_False(t *testing.T) {
args: []string{"--ipmiwrite=false", "n01"},
wantErr: false,
stdout: "",
inDB: `WW_INTERNAL: 43
nodeprofiles:
inDB: `nodeprofiles:
default:
ipmi:
write: "true"
@@ -199,8 +186,7 @@ nodes:
profiles:
- default
`,
outDb: `WW_INTERNAL: 43
nodeprofiles:
outDb: `nodeprofiles:
default:
ipmi:
write: "true"
@@ -269,16 +255,14 @@ func Test_Multiple_Set_Tests(t *testing.T) {
args: []string{"--profile=foo", "n01"},
wantErr: false,
stdout: "",
inDB: `WW_INTERNAL: 45
nodeprofiles:
inDB: `nodeprofiles:
default:
comment: testit
nodes:
n01:
profiles:
- default`,
outDb: `WW_INTERNAL: 45
nodeprofiles:
outDb: `nodeprofiles:
default:
comment: testit
nodes:
@@ -292,8 +276,7 @@ nodes:
args: []string{"--profile=foo", "n0[1-2]"},
wantErr: false,
stdout: "",
inDB: `WW_INTERNAL: 45
nodeprofiles:
inDB: `nodeprofiles:
default:
comment: testit
nodes:
@@ -303,8 +286,7 @@ nodes:
n02:
profiles:
- default`,
outDb: `WW_INTERNAL: 45
nodeprofiles:
outDb: `nodeprofiles:
default:
comment: testit
nodes:
@@ -321,16 +303,14 @@ nodes:
args: []string{"--ipmitagadd", "foo=baar", "n01"},
wantErr: false,
stdout: "",
inDB: `WW_INTERNAL: 45
nodeprofiles:
inDB: `nodeprofiles:
default:
comment: testit
nodes:
n01:
profiles:
- default`,
outDb: `WW_INTERNAL: 45
nodeprofiles:
outDb: `nodeprofiles:
default:
comment: testit
nodes:
@@ -347,8 +327,7 @@ nodes:
args: []string{"--tagdel", "tag1", "n01"},
wantErr: false,
stdout: "",
inDB: `WW_INTERNAL: 45
nodeprofiles:
inDB: `nodeprofiles:
default:
comment: testit
nodes:
@@ -358,8 +337,7 @@ nodes:
tags:
tag1: value1
tag2: value2`,
outDb: `WW_INTERNAL: 45
nodeprofiles:
outDb: `nodeprofiles:
default:
comment: testit
nodes:
@@ -375,8 +353,7 @@ nodes:
args: []string{"--fsname=var", "--fspath=/var", "--fsformat=btrfs", "--partname=var", "--partnumber=1", "--diskname=/dev/vda", "n01"},
wantErr: false,
stdout: "",
inDB: `WW_INTERNAL: 45
nodeprofiles:
inDB: `nodeprofiles:
default:
comment: testit
nodes:
@@ -384,8 +361,7 @@ nodes:
profiles:
- default
`,
outDb: `WW_INTERNAL: 45
nodeprofiles:
outDb: `nodeprofiles:
default:
comment: testit
nodes:
@@ -408,8 +384,7 @@ nodes:
args: []string{"--fsdel=foo", "n01"},
wantErr: true,
stdout: "",
inDB: `WW_INTERNAL: 45
nodeprofiles:
inDB: `nodeprofiles:
default:
comment: testit
nodes:
@@ -427,8 +402,7 @@ nodes:
format: btrfs
path: /var
`,
outDb: `WW_INTERNAL: 45
nodeprofiles:
outDb: `nodeprofiles:
default:
comment: testit
nodes:
@@ -451,8 +425,7 @@ nodes:
args: []string{"--fsdel=/dev/disk/by-partlabel/var", "n01"},
wantErr: false,
stdout: "",
inDB: `WW_INTERNAL: 45
nodeprofiles:
inDB: `nodeprofiles:
default:
comment: testit
nodes:
@@ -470,8 +443,7 @@ nodes:
format: btrfs
path: /var
`,
outDb: `WW_INTERNAL: 45
nodeprofiles:
outDb: `nodeprofiles:
default:
comment: testit
nodes:
@@ -490,8 +462,7 @@ nodes:
args: []string{"--partdel=var", "n01"},
wantErr: false,
stdout: "",
inDB: `WW_INTERNAL: 45
nodeprofiles:
inDB: `nodeprofiles:
default:
comment: testit
nodes:
@@ -509,8 +480,7 @@ nodes:
format: btrfs
path: /var
`,
outDb: `WW_INTERNAL: 45
nodeprofiles:
outDb: `nodeprofiles:
default:
comment: testit
nodes:
@@ -528,8 +498,7 @@ nodes:
args: []string{"--diskdel=/dev/vda", "n01"},
wantErr: false,
stdout: "",
inDB: `WW_INTERNAL: 45
nodeprofiles:
inDB: `nodeprofiles:
default:
comment: testit
nodes:
@@ -546,8 +515,7 @@ nodes:
format: btrfs
path: /var
`,
outDb: `WW_INTERNAL: 45
nodeprofiles:
outDb: `nodeprofiles:
default:
comment: testit
nodes:
@@ -565,16 +533,14 @@ nodes:
args: []string{"--mtu", "1234", "--netname=mynet", "n01"},
wantErr: false,
stdout: "",
inDB: `WW_INTERNAL: 45
nodeprofiles:
inDB: `nodeprofiles:
default:
comment: testit
nodes:
n01:
profiles:
- default`,
outDb: `WW_INTERNAL: 45
nodeprofiles:
outDb: `nodeprofiles:
default:
comment: testit
nodes:
@@ -591,8 +557,7 @@ nodes:
args: []string{"--tagadd", "nodetag1=nodevalue1", "n01"},
wantErr: false,
stdout: "",
inDB: `WW_INTERNAL: 45
nodeprofiles:
inDB: `nodeprofiles:
p1:
comment: testit 1
tags:
@@ -606,8 +571,7 @@ nodes:
profiles:
- p1
- p2`,
outDb: `WW_INTERNAL: 45
nodeprofiles:
outDb: `nodeprofiles:
p1:
comment: testit 1
tags:
@@ -630,13 +594,11 @@ nodes:
args: []string{"n01", "--comment", "This is a , comment"},
wantErr: false,
stdout: "",
inDB: `WW_INTERNAL: 43
nodes:
inDB: `nodes:
n01:
comment: old comment
`,
outDb: `WW_INTERNAL: 43
nodeprofiles: {}
outDb: `nodeprofiles: {}
nodes:
n01:
comment: This is a , comment
@@ -644,7 +606,7 @@ nodes:
},
}
conf_yml := `WW_INTERNAL: 0`
conf_yml := ``
tempWarewulfConf, warewulfConfErr := os.CreateTemp("", "warewulf.conf-")
assert.NoError(t, warewulfConfErr)
defer os.Remove(tempWarewulfConf.Name())
@@ -669,8 +631,7 @@ func Test_Node_Add(t *testing.T) {
args: []string{"--tagadd=email=node", "n01"},
wantErr: false,
stdout: "",
inDB: `WW_INTERNAL: 43
nodeprofiles:
inDB: `nodeprofiles:
default:
comment: testit
tags:
@@ -679,8 +640,7 @@ nodes:
n01:
profiles:
- default`,
outDb: `WW_INTERNAL: 43
nodeprofiles:
outDb: `nodeprofiles:
default:
comment: testit
tags:
@@ -697,8 +657,7 @@ nodes:
args: []string{"--tagadd=newtag=newval", "n01"},
wantErr: false,
stdout: "",
inDB: `WW_INTERNAL: 43
nodeprofiles:
inDB: `nodeprofiles:
default:
comment: testit
tags:
@@ -709,8 +668,7 @@ nodes:
- default
tags:
email: node`,
outDb: `WW_INTERNAL: 43
nodeprofiles:
outDb: `nodeprofiles:
default:
comment: testit
tags:

View File

@@ -14,7 +14,7 @@ type variables struct {
setNodeAll bool
setYes bool
setForce bool
nodeConf node.NodeConf
nodeConf node.Node
nodeDel node.NodeConfDel
nodeAdd node.NodeConfAdd
}