wwctl commands without NodeInfo

mostly remove Get and calls for the id

Signed-off-by: Christian Goll <cgoll@suse.com>
This commit is contained in:
Christian Goll
2023-12-15 15:40:22 +01:00
committed by Jonathon Anderson
parent 28a7b9fe84
commit 457c7c16b1
47 changed files with 239 additions and 363 deletions

View File

@@ -15,7 +15,7 @@ import (
func CobraRunE(cmd *cobra.Command, args []string) error {
if len(args) == 0 && !OptDetect {
wwlog.Error("the '--detect' flag is needed, if no kernel version is suppiled")
wwlog.Error("the '--detect' flag is needed, if no kernel version is supplied")
os.Exit(1)
}
if OptDetect && (OptRoot == "" || OptContainer == "") {
@@ -66,14 +66,10 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
//TODO: Don't loop through profiles, instead have a nodeDB function that goes directly to the map
profiles, _ := nodeDB.FindAllProfiles()
for _, profile := range profiles {
wwlog.Debug("Looking for profile default: %s", profile.Id.Get())
if profile.Id.Get() == "default" {
wwlog.Debug("Looking for profile default: %s", profile.Id())
if profile.Id() == "default" {
wwlog.Debug("Found profile default, setting kernel version to: %s", args[0])
profile.Kernel.Override.Set(args[0])
err := nodeDB.ProfileUpdate(profile)
if err != nil {
return errors.Wrap(err, "failed to update node profile")
}
profile.Kernel.Override = args[0]
}
}
err = nodeDB.Persist()