added hash check for node edit
Signed-off-by: Christian Goll <cgoll@suse.de>
This commit is contained in:
20
internal/pkg/api/node/hash.go
Normal file
20
internal/pkg/api/node/hash.go
Normal 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[:]),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user