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

@@ -0,0 +1,20 @@
package apinode
import (
"encoding/hex"
"github.com/hpcng/warewulf/internal/pkg/api/routes/wwapiv1"
"github.com/hpcng/warewulf/internal/pkg/node"
"github.com/hpcng/warewulf/internal/pkg/wwlog"
)
func Hash() *wwapiv1.NodeDBHash {
config, err := node.New()
if err != nil {
wwlog.Warn("couldb't read config")
}
hash := config.Hash()
return &wwapiv1.NodeDBHash{
Hash: hex.EncodeToString(hash[:]),
}
}