diff --git a/internal/link/enrolment.go b/internal/link/enrolment.go index a7c05f8..a2a77cf 100644 --- a/internal/link/enrolment.go +++ b/internal/link/enrolment.go @@ -7,6 +7,7 @@ import ( "encoding/base64" "errors" "fmt" + "log" "sort" "github.com/novox/mesh-controller/internal/broker" @@ -161,6 +162,9 @@ func (e Enrolment) Heard(ctx context.Context, report Report) error { // this with only a node name; a real report always carries an account (something applied, or // a refusal, or a failure), so those are the reports that get written down. if report.Applied == nil && report.Refused == "" && len(report.Failed) == 0 { + if report.Superseded != "" { + log.Printf("%s set aside declaration %s for the newer %s", report.Node, report.Declared, report.Superseded) + } return e.Inventory.Seen(ctx, node.ID) } // What it did is kept whichever way it went. Until this, a refusal or a failure moved diff --git a/internal/link/protocol.go b/internal/link/protocol.go index 28c37c4..efac2ca 100644 --- a/internal/link/protocol.go +++ b/internal/link/protocol.go @@ -85,6 +85,11 @@ type Report struct { Applied []string `json:"applied,omitempty"` Failed map[string]string `json:"failed,omitempty"` Refused string `json:"refused,omitempty"` + // Superseded names the newer declaration the reported one was set aside for, unapplied — a + // machine asked to be several things in a row becomes the last (novox/hq issue 031). Not an + // account of the machine: it moves last_seen and nothing else, like a bare word that the node + // is there, because the report for the declaration that WAS applied follows at once. + Superseded string `json:"superseded,omitempty"` // Carried are the machine's ports held by what that host raised from its own bundle. //