From 0aca225ef7b048f198f91e9b3a6b80ce37a866ee Mon Sep 17 00:00:00 2001 From: Yong Qin Date: Tue, 5 Mar 2024 09:58:20 -0800 Subject: [PATCH] Fixed a bug with profile list when kernelargs are set with 'var=val' format. This also removed the unnecessary '--' for the source profile since it's never used. --- internal/app/wwctl/profile/list/main.go | 4 ++-- internal/pkg/api/profile/list.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/app/wwctl/profile/list/main.go b/internal/app/wwctl/profile/list/main.go index ceabf1eb..8e7c995e 100644 --- a/internal/app/wwctl/profile/list/main.go +++ b/internal/app/wwctl/profile/list/main.go @@ -26,9 +26,9 @@ func CobraRunE(vars *variables) func(cmd *cobra.Command, args []string) (err err } if len(profileInfo.Output) > 0 { - ph := helper.NewPrintHelper(strings.Split(profileInfo.Output[0], "=")) + ph := helper.NewPrintHelper(strings.Split(profileInfo.Output[0], ":=:")) for _, val := range profileInfo.Output[1:] { - ph.Append(strings.Split(val, "=")) + ph.Append(strings.Split(val, ":=:")) } ph.Render() } diff --git a/internal/pkg/api/profile/list.go b/internal/pkg/api/profile/list.go index ccb93e8c..2c696d48 100644 --- a/internal/pkg/api/profile/list.go +++ b/internal/pkg/api/profile/list.go @@ -32,20 +32,20 @@ func ProfileList(ShowOpt *wwapiv1.GetProfileList) (profileList wwapiv1.ProfileLi if ShowOpt.ShowAll || ShowOpt.ShowFullAll { for _, p := range profiles { profileList.Output = append(profileList.Output, - fmt.Sprintf("%s=%s=%s=%s", "PROFILE", "FIELD", "PROFILE", "VALUE")) + fmt.Sprintf("%s:=:%s:=:%s", "PROFILE", "FIELD", "VALUE")) fields := p.GetFields(ShowOpt.ShowFullAll) for _, f := range fields { profileList.Output = append(profileList.Output, - fmt.Sprintf("%s=%s=%s=%s", p.Id.Print(), f.Field, f.Source, f.Value)) + fmt.Sprintf("%s:=:%s:=:%s", p.Id.Print(), f.Field, f.Value)) } } } else { profileList.Output = append(profileList.Output, - fmt.Sprintf("%s=%s", "PROFILE NAME", "COMMENT/DESCRIPTION")) + fmt.Sprintf("%s:=:%s", "PROFILE NAME", "COMMENT/DESCRIPTION")) for _, profile := range profiles { profileList.Output = append(profileList.Output, - fmt.Sprintf("%s=%s", profile.Id.Print(), profile.Comment.Print())) + fmt.Sprintf("%s:=:%s", profile.Id.Print(), profile.Comment.Print())) } } return