Compose each machine in the merge gate with its engine's contract, so moved modules are handed there as on the mesh (issue 969)
This commit is contained in:
@@ -1017,6 +1017,13 @@ func raiseFromFacts(ctx context.Context, open *stores, f snapshot.Facts, shelf m
|
||||
"kernel": m.Kernel, "capabilities": caps}); err != nil {
|
||||
return notes, err
|
||||
}
|
||||
// What its node-engine takes, as the mesh composes it today (issue 969): without the statement the gate
|
||||
// composes a moved module the old way on a machine the mesh hands it to.
|
||||
if stated, ok := standInHealth(m, f.Taken); ok {
|
||||
if _, err := inv.RecordHealth(ctx, stated); err != nil {
|
||||
return notes, err
|
||||
}
|
||||
}
|
||||
for _, record := range []func(context.Context, string, string) error{inv.RecordSealingKey, inv.RecordOverlayKey} {
|
||||
key, err := standInKey()
|
||||
if err != nil {
|
||||
@@ -1355,3 +1362,12 @@ func firstOr(items, otherwise []string) string {
|
||||
}
|
||||
return "it says nothing more"
|
||||
}
|
||||
|
||||
// standInHealth is the statement the gate gives a machine of the snapshot so that it composes as the mesh does:
|
||||
// only its contract, which says whether it takes handed files (issue 969). False for a snapshot that carries none.
|
||||
func standInHealth(m snapshot.Machine, taken time.Time) (inventory.NodeHealth, bool) {
|
||||
if m.Contract == 0 {
|
||||
return inventory.NodeHealth{}, false
|
||||
}
|
||||
return inventory.NodeHealth{Node: m.Name, Contract: m.Contract, SaidAt: taken, HeardAt: taken}, true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user