2022-05-13 15:38:19 +02:00
|
|
|
package check
|
|
|
|
|
|
|
|
import (
|
2022-09-22 11:46:36 +02:00
|
|
|
"code.icb4dc0.de/prskr/nurse/config"
|
|
|
|
"code.icb4dc0.de/prskr/nurse/grammar"
|
2022-05-13 15:38:19 +02:00
|
|
|
)
|
|
|
|
|
2022-06-09 22:40:32 +02:00
|
|
|
func CheckForScript(script []grammar.Check, lkp ModuleLookup, srvLookup config.ServerLookup) (Collection, error) {
|
2022-05-13 15:38:19 +02:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
|
2023-12-04 11:22:49 +01:00
|
|
|
return compiledChecks, nil
|
2022-05-13 15:38:19 +02:00
|
|
|
}
|