diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d091b3a..fbb8fd99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -135,6 +135,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Format errors in logs as strings. #1563 - Fix display of profiles during node list. #1496 - Fix internal DelProfile function to correctly operate on profiles rather than nodes. #1622 +- Fix parsing of bool command line variables #1627 ## v4.5.8, 2024-10-01 diff --git a/internal/app/wwctl/node/set/main_test.go b/internal/app/wwctl/node/set/main_test.go index 693b989e..5ae8cb91 100644 --- a/internal/app/wwctl/node/set/main_test.go +++ b/internal/app/wwctl/node/set/main_test.go @@ -382,6 +382,30 @@ nodes: ipaddr: 172.16.130.101 `, }, + { + name: "single node set onboot", + args: []string{"--netname", "default", "--onboot=true", "n01"}, + wantErr: false, + stdout: "", + inDB: `nodeprofiles: + default: {} +nodes: + n01: + network devices: + default: + ipaddr: 172.16.130.101 + +`, + outDb: `nodeprofiles: + default: {} +nodes: + n01: + network devices: + default: + ipaddr: 172.16.130.101 + onboot: "true" +`, + }, { name: "single node set fs,part and disk", diff --git a/internal/pkg/node/util.go b/internal/pkg/node/util.go index 478e55a4..d0d2d271 100644 --- a/internal/pkg/node/util.go +++ b/internal/pkg/node/util.go @@ -66,7 +66,7 @@ func ObjectIsEmpty(obj interface{}) bool { } for i := 0; i < varType.NumField(); i++ { if varType.Field(i).Type.Kind() == reflect.String && !varVal.Field(i).IsZero() { - val := varVal.Field(i).Interface().(string) + val := varVal.Field(i).String() if val != "" { return false }