Add info logging to node repo

This commit is contained in:
Jan Eitzinger 2025-06-06 06:12:02 +02:00
parent 9cd4b3c1cc
commit ca16a80b1f
2 changed files with 3 additions and 2 deletions

View File

@ -24,7 +24,7 @@ type UpdateNodeStatesRequest struct {
Cluster string `json:"cluster" example:"fritz"` Cluster string `json:"cluster" example:"fritz"`
} }
// this routine assumes that only one of them applies per node // this routine assumes that only one of them exists per node
func determineState(states []string) schema.NodeState { func determineState(states []string) schema.NodeState {
for _, state := range states { for _, state := range states {
switch strings.ToLower(state) { switch strings.ToLower(state) {

View File

@ -177,6 +177,7 @@ func (r *NodeRepository) UpdateNodeState(hostname string, cluster string, nodeSt
return err return err
} }
log.Infof("Added node '%s' to database", hostname)
return nil return nil
} else { } else {
log.Warnf("Error while querying node '%v' from database", id) log.Warnf("Error while querying node '%v' from database", id)
@ -188,7 +189,7 @@ func (r *NodeRepository) UpdateNodeState(hostname string, cluster string, nodeSt
log.Errorf("error while updating node '%s'", hostname) log.Errorf("error while updating node '%s'", hostname)
return err return err
} }
log.Infof("Updated node '%s' in database", hostname)
return nil return nil
} }