added profile set over API

This commit is contained in:
Christian Goll
2022-07-13 15:56:04 +02:00
parent f0eb3f8504
commit 14b86a5e8e
7 changed files with 188 additions and 440 deletions

View File

@@ -1,4 +1,4 @@
package node
package apinode
import (
"encoding/json"
@@ -477,7 +477,7 @@ func NodeSet(set *wwapiv1.NodeSetParameter) (err error) {
if err != nil {
return
}
return nodeDbSave(&nodeDB)
return DbSave(&nodeDB)
}
// NodeSetParameterCheck does error checking on NodeSetParameter.
@@ -658,24 +658,6 @@ func checkNetNameRequired(netname string) (err error) {
return
}
// nodeDbSave persists the nodeDB to disk and restarts warewulfd.
// TODO: We will likely need locking around anything changing nodeDB
// or restarting warewulfd. Determine if the reason for restart is
// just to reinitialize warewulfd with the new nodeDB or if there is
// something more to it.
func nodeDbSave(nodeDB *node.NodeYaml) (err error) {
err = nodeDB.Persist()
if err != nil {
return errors.Wrap(err, "failed to persist nodedb")
}
err = warewulfd.DaemonReload()
if err != nil {
return errors.Wrap(err, "failed to reload warewulf daemon")
}
return
}
/*
Add the netname to the options map, as its only known after the map
command line options have been read out.