diff --git a/CHANGELOG.md b/CHANGELOG.md index 039556476..82814e2ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -145,6 +145,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - modules are now correctly included - move hostlist into internal alongside other warewulf code #804 - uniform shebang usage in scripts of init.d folder #821 +- Check if commas are allowes in node/profile set ## [4.4.0] 2023-01-18 diff --git a/internal/app/wwctl/node/set/main_test.go b/internal/app/wwctl/node/set/main_test.go index ed4a1b714..c77f7409d 100644 --- a/internal/app/wwctl/node/set/main_test.go +++ b/internal/app/wwctl/node/set/main_test.go @@ -2,9 +2,12 @@ package set import ( "bytes" + "os" "testing" "github.com/stretchr/testify/assert" + warewulfconf "github.com/warewulf/warewulf/internal/pkg/config" + "github.com/warewulf/warewulf/internal/pkg/node" "github.com/warewulf/warewulf/internal/pkg/testenv" "github.com/warewulf/warewulf/internal/pkg/warewulfd" ) @@ -408,8 +411,40 @@ nodes: - p2 tags: nodetag1: nodevalue1 +`}, + {name: "single node set comma in comment", + args: []string{"n01", "--comment", "This is a , comment"}, + wantErr: false, + stdout: "", + inDB: `WW_INTERNAL: 43 +nodes: + n01: + comment: old comment +`, + outDb: `WW_INTERNAL: 43 +nodeprofiles: {} +nodes: + n01: + comment: This is a , comment + profiles: + - default `}, } + + conf_yml := `WW_INTERNAL: 0` + tempWarewulfConf, warewulfConfErr := os.CreateTemp("", "warewulf.conf-") + assert.NoError(t, warewulfConfErr) + defer os.Remove(tempWarewulfConf.Name()) + _, warewulfConfErr = tempWarewulfConf.Write([]byte(conf_yml)) + assert.NoError(t, warewulfConfErr) + assert.NoError(t, tempWarewulfConf.Sync()) + assert.NoError(t, warewulfconf.New().Read(tempWarewulfConf.Name())) + + tempNodeConf, nodesConfErr := os.CreateTemp("", "nodes.conf-") + assert.NoError(t, nodesConfErr) + defer os.Remove(tempNodeConf.Name()) + node.ConfigFile = tempNodeConf.Name() + warewulfd.SetNoDaemon() for _, tt := range tests { run_test(t, tt) } diff --git a/internal/pkg/node/flags.go b/internal/pkg/node/flags.go index 7e45c9890..0c4269974 100644 --- a/internal/pkg/node/flags.go +++ b/internal/pkg/node/flags.go @@ -17,10 +17,6 @@ must be called, as the commandline parser returns e.g. netip.IP objects which mu back to strings. */ func (nodeConf *NodeConf) CreateFlags(baseCmd *cobra.Command, excludeList []string) (converters []func() error) { - /* - nodeInfoType := reflect.TypeOf(nodeConf) - nodeInfoVal := reflect.ValueOf(nodeConf) - */ return RecursiveCreateFlags(nodeConf, baseCmd, excludeList) }