added hash check for node edit

Signed-off-by: Christian Goll <cgoll@suse.de>
This commit is contained in:
Christian Goll
2023-02-28 15:58:44 +01:00
parent ee4f9d53d6
commit b4acf0fdf2
10 changed files with 604 additions and 432 deletions

View File

@@ -2,6 +2,7 @@ package node
import (
"crypto/sha256"
"encoding/hex"
"github.com/hpcng/warewulf/internal/pkg/wwlog"
"gopkg.in/yaml.v2"
@@ -24,3 +25,11 @@ func (config *NodeYaml) Hash() [32]byte {
}
return sha256.Sum256(data)
}
/*
Return the hash as string
*/
func (config *NodeYaml) StringHash() string {
buffer := config.Hash()
return hex.EncodeToString(buffer[:])
}