A converged machine says its strays too
node show printed what a machine reports only for an adopted one; a converged machine holds nothing and can still run a container nobody asked for (hq ADR 0163), so its strays are said whatever its mode.
This commit is contained in:
@@ -24,6 +24,11 @@ import (
|
||||
func showMode(ctx context.Context, inv *inventory.Inventory, node inventory.Node) error {
|
||||
if !node.Adopted {
|
||||
fmt.Printf(" mode converged\n")
|
||||
// A converged machine holds nothing, and can still run what nobody asked for
|
||||
// (novox/hq ADR 0163): what it reports as strays is said whatever its mode.
|
||||
if said, err := inv.AdoptionOf(ctx, node.Name); err == nil && len(said.Strays) > 0 {
|
||||
showStrays(said.Strays)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
fmt.Printf(" mode adopted since %s\n",
|
||||
@@ -66,16 +71,22 @@ func showMode(ctx context.Context, inv *inventory.Inventory, node inventory.Node
|
||||
fmt.Printf(" %-17s %s\n", "", f)
|
||||
}
|
||||
}
|
||||
if len(said.Strays) > 0 {
|
||||
fmt.Printf(" strays %d container(s) the mesh neither wrote nor holds:\n", len(said.Strays))
|
||||
for _, s := range said.Strays {
|
||||
fmt.Printf(" %-17s %s (%s)\n", "", s.Name, s.Detail)
|
||||
}
|
||||
}
|
||||
showStrays(said.Strays)
|
||||
fmt.Printf(" as of %s\n", said.At.Local().Format(time.DateTime))
|
||||
return nil
|
||||
}
|
||||
|
||||
// showStrays says what a machine runs that the mesh neither wrote nor holds (ADR 0163).
|
||||
func showStrays(strays []inventory.Stray) {
|
||||
if len(strays) == 0 {
|
||||
return
|
||||
}
|
||||
fmt.Printf(" strays %d container(s) the mesh neither wrote nor holds:\n", len(strays))
|
||||
for _, s := range strays {
|
||||
fmt.Printf(" %-17s %s (%s)\n", "", s.Name, s.Detail)
|
||||
}
|
||||
}
|
||||
|
||||
// showTunnel is the node show lines about the tunnel an adopted node found and carried (novox/hq
|
||||
// ADR 0105): what it presented at enrolment, and what it last said about taking it over.
|
||||
func showTunnel(ctx context.Context, inv *inventory.Inventory, name string) error {
|
||||
|
||||
Reference in New Issue
Block a user