Use ctx.States() for federation status in HTML report
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Derive federation badge from rule states when available; fall back to raw FederationOK observation field when states are absent.
This commit is contained in:
parent
86b5207a8f
commit
e9fa669682
1 changed files with 16 additions and 1 deletions
|
|
@ -296,8 +296,23 @@ func (p *matrixProvider) GetHTMLReport(ctx sdk.ReportContext) (string, error) {
|
|||
return "", fmt.Errorf("failed to unmarshal matrix report: %w", err)
|
||||
}
|
||||
|
||||
// When states are available, derive the federation verdict from them so the
|
||||
// report badge and the rule output never disagree. Fall back to the raw
|
||||
// observation flag when the host hasn't threaded rule output yet.
|
||||
states := ctx.States()
|
||||
federationOK := r.FederationOK
|
||||
if len(states) > 0 {
|
||||
federationOK = true
|
||||
for _, st := range states {
|
||||
if st.Status == sdk.StatusCrit || st.Status == sdk.StatusError || st.Status == sdk.StatusWarn {
|
||||
federationOK = false
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data := matrixTemplateData{
|
||||
FederationOK: r.FederationOK,
|
||||
FederationOK: federationOK,
|
||||
WellKnownServer: r.WellKnownResult.Server,
|
||||
WellKnownResult: r.WellKnownResult.Result,
|
||||
SRVSkipped: r.DNSResult.SRVSkipped,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue