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
715af92c55
10 changed files with 160 additions and 18 deletions
|
|
@ -33,14 +33,14 @@ func (r *delegationRule) ValidateOptions(opts sdk.CheckerOptions) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (r *delegationRule) Evaluate(ctx context.Context, obs sdk.ObservationGetter, opts sdk.CheckerOptions) sdk.CheckState {
|
||||
func (r *delegationRule) Evaluate(ctx context.Context, obs sdk.ObservationGetter, opts sdk.CheckerOptions) []sdk.CheckState {
|
||||
var data DelegationData
|
||||
if err := obs.Get(ctx, ObservationKeyDelegation, &data); err != nil {
|
||||
return sdk.CheckState{
|
||||
return []sdk.CheckState{{
|
||||
Status: sdk.StatusError,
|
||||
Message: fmt.Sprintf("Failed to get delegation data: %v", err),
|
||||
Code: "delegation_error",
|
||||
}
|
||||
}}
|
||||
}
|
||||
return Evaluate(&data)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue