Use ProfileConf rather than NodeConf for profile commands

This removes node-only attributes, like a profile list, from profile commands.

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
Jonathon Anderson
2024-10-17 15:25:41 -04:00
parent 6460ca827a
commit d91d273ac7
6 changed files with 38 additions and 18 deletions

View File

@@ -41,7 +41,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
Output: args,
}
profileListMsg := apiprofile.FilteredProfiles(&filterList)
profileMap := make(map[string]*node.NodeConf)
profileMap := make(map[string]*node.ProfileConf)
// got proper yaml back
_ = yaml.Unmarshal([]byte(profileListMsg.NodeConfMapYaml), profileMap)
file, err := os.CreateTemp(os.TempDir(), "ww4ProfileEdit*.yaml")
@@ -49,7 +49,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
wwlog.Error("Could not create temp file:%s \n", err)
}
defer os.Remove(file.Name())
yamlTemplate := node.UnmarshalConf(node.NodeConf{}, []string{"tagsdel"})
yamlTemplate := node.UnmarshalConf(node.ProfileConf{}, []string{"tagsdel"})
for {
_ = file.Truncate(0)
_, _ = file.Seek(0, 0)
@@ -77,7 +77,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
wwlog.Debug("Hashes are before %s and after %s\n", sum1, sum2)
if sum1 != sum2 {
wwlog.Debug("Profiles were modified")
modifiedProfileMap := make(map[string]*node.NodeConf)
modifiedProfileMap := make(map[string]*node.ProfileConf)
_, _ = file.Seek(0, 0)
// ignore error as only may occurs under strange circumstances
buffer, _ := io.ReadAll(file)