Keep what an adopted node reports holding, the firewall it found and what is reachable on it (hq ADR 0100)
This commit is contained in:
@@ -29,9 +29,40 @@ func showMode(ctx context.Context, inv *inventory.Inventory, node inventory.Node
|
||||
} else {
|
||||
fmt.Printf(" taken %s\n", strings.Join(taken, ", "))
|
||||
}
|
||||
said, err := inv.AdoptionOf(ctx, node.Name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if said.At.IsZero() {
|
||||
fmt.Printf(" it has not yet said what it found\n")
|
||||
return nil
|
||||
}
|
||||
fmt.Printf(" firewall found %s\n", orNone(said.Firewall))
|
||||
if len(said.Held) == 0 {
|
||||
fmt.Printf(" holding nothing found\n")
|
||||
}
|
||||
for _, h := range said.Held {
|
||||
// A held thing that changed is how a predecessor still writing is caught: said first.
|
||||
line := fmt.Sprintf(" holds %-11s %s %s, for %s", h.Kind, h.Target, h.ID, h.Module)
|
||||
if h.Changed != "" {
|
||||
line += " — " + strings.ToUpper(h.Changed) + " by something other than the mesh"
|
||||
}
|
||||
fmt.Println(line)
|
||||
if h.Kept != "" {
|
||||
fmt.Printf(" %-17s original kept at %s\n", "", h.Kept)
|
||||
}
|
||||
}
|
||||
fmt.Printf(" as of %s\n", said.At.Local().Format(time.DateTime))
|
||||
return nil
|
||||
}
|
||||
|
||||
func orNone(s string) string {
|
||||
if s == "" {
|
||||
return "none reported"
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
// adoptedNodes are the names of every adopted node, in the order given.
|
||||
func adoptedNodes(nodes []inventory.Node) []string {
|
||||
var out []string
|
||||
|
||||
Reference in New Issue
Block a user