Migrate to checker-sdk-go v1.3.0 with standalone build tag
The SDK split the HTTP server scaffolding into the new checker-sdk-go/checker/server subpackage and CheckRule.Evaluate now returns []CheckState. Update main.go to import server and call server.New, switch the rule and the package-level Evaluate helper to the new slice return type, and isolate the interactive form code behind the standalone build tag so plugin/builtin builds skip net/http and html/template entirely.
This commit is contained in:
parent
00de0f9780
commit
d4c1ac348a
10 changed files with 157 additions and 18 deletions
|
|
@ -9,7 +9,7 @@ import (
|
|||
// Evaluate folds findings into a single CheckState. The status is the
|
||||
// highest severity observed: any Crit makes the whole result Crit, any Warn
|
||||
// makes it Warn, otherwise OK.
|
||||
func Evaluate(data *DelegationData) sdk.CheckState {
|
||||
func Evaluate(data *DelegationData) []sdk.CheckState {
|
||||
status := sdk.StatusOK
|
||||
var crit, warn, info int
|
||||
for _, f := range data.Findings {
|
||||
|
|
@ -37,7 +37,7 @@ func Evaluate(data *DelegationData) sdk.CheckState {
|
|||
msg = fmt.Sprintf("Delegation of %s: %d critical, %d warning, %d info", data.DelegatedFQDN, crit, warn, info)
|
||||
}
|
||||
|
||||
return sdk.CheckState{
|
||||
return []sdk.CheckState{{
|
||||
Status: status,
|
||||
Message: msg,
|
||||
Code: "delegation_result",
|
||||
|
|
@ -49,5 +49,5 @@ func Evaluate(data *DelegationData) sdk.CheckState {
|
|||
"parent_ds": data.ParentDS,
|
||||
"child_serials": data.ChildSerials,
|
||||
},
|
||||
}
|
||||
}}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue