Name every held kind of each module the flip takes in the converge preview and its digest (hq ADR 0103)
This commit is contained in:
@@ -119,7 +119,7 @@ func take(ctx context.Context, open *stores, node, module string) (string, error
|
||||
var replaces []string
|
||||
for _, h := range reported.Held {
|
||||
if h.Module == module {
|
||||
replaces = append(replaces, fmt.Sprintf(" %s %s (%s)", h.Kind, h.Target, h.ID))
|
||||
replaces = append(replaces, " "+heldLine(h))
|
||||
}
|
||||
}
|
||||
if len(replaces) > 0 {
|
||||
@@ -347,14 +347,18 @@ func previewOf(node string, reported inventory.Adoption, derived derivedFilter,
|
||||
for _, m := range takes {
|
||||
fmt.Fprintf(&b, " %s\n", m)
|
||||
said = append(said, "take "+m)
|
||||
// Every kind it holds — a directory, a service, an archive, a process, a user as well as a
|
||||
// file (novox/hq ADR 0103) — each said, and each part of what the flip is asked to act on.
|
||||
for _, h := range reported.Held {
|
||||
if h.Module == m && h.Kind == "file" {
|
||||
fmt.Fprintf(&b, " replacing the found file %s", h.Target)
|
||||
if h.Kept != "" {
|
||||
fmt.Fprintf(&b, " (original kept at %s)", h.Kept)
|
||||
}
|
||||
b.WriteString("\n")
|
||||
if h.Module != m {
|
||||
continue
|
||||
}
|
||||
fmt.Fprintf(&b, " replacing the found %s", heldLine(h))
|
||||
if h.Kept != "" {
|
||||
fmt.Fprintf(&b, ", original kept at %s", h.Kept)
|
||||
}
|
||||
b.WriteString("\n")
|
||||
said = append(said, "replace "+m+" "+heldLine(h)+" "+h.Kept)
|
||||
}
|
||||
}
|
||||
if !filterAssigned {
|
||||
@@ -427,6 +431,11 @@ func (d derivedFilter) fate(r inventory.Reach) string {
|
||||
return "WILL CLOSE — no module assigned here declares it"
|
||||
}
|
||||
|
||||
// heldLine is one thing a node holds as found, as take and the converge preview both say it.
|
||||
func heldLine(h inventory.Held) string {
|
||||
return fmt.Sprintf("%s %s (%s)", h.Kind, h.Target, h.ID)
|
||||
}
|
||||
|
||||
// loopback is an address nothing off the machine reaches.
|
||||
func loopback(address string) bool {
|
||||
a := strings.Trim(address, "[]")
|
||||
|
||||
Reference in New Issue
Block a user