Merge pull request #1119 from yqin/fix_profile_list

Fixed profile list bug
This commit is contained in:
Christian Goll
2024-03-11 11:08:53 +01:00
committed by GitHub
3 changed files with 7 additions and 6 deletions

View File

@@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Systems with no SMBIOS (Raspberry Pi) will create a UUID from
`/sys/firmware/devicetree/base/serial-number`
- Fix `wwctl profile list -a` format when kernerargs are set
## [4.5.0] 2024-02-08

View File

@@ -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()
}

View File

@@ -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