nurse/check/endpoint.go
Peter Kurfer 9791e9f282
All checks were successful
Renovate / renovate (push) Successful in 40s
Go build / build (push) Successful in 8m44s
feat: refactor to server and exec-check subcommands
- allow to interactively execute checks instead of server mode
- use urfave/cli for subcommands
2023-12-04 11:22:49 +01:00

27 lines
603 B
Go

package check
import (
"code.icb4dc0.de/prskr/nurse/config"
"code.icb4dc0.de/prskr/nurse/grammar"
)
func CheckForScript(script []grammar.Check, lkp ModuleLookup, srvLookup config.ServerLookup) (Collection, error) {
compiledChecks := make([]SystemChecker, 0, len(script))
for i := range script {
rawChk := script[i]
mod, err := lkp.Lookup(rawChk.Initiator.Module)
if err != nil {
return nil, err
}
compiledCheck, err := mod.Lookup(rawChk, srvLookup)
if err != nil {
return nil, err
}
compiledChecks = append(compiledChecks, compiledCheck)
}
return compiledChecks, nil
}