diff --git a/cmd/mesh-controller/module_health.go b/cmd/mesh-controller/module_health.go index b40c6818..17f83ec4 100644 --- a/cmd/mesh-controller/module_health.go +++ b/cmd/mesh-controller/module_health.go @@ -388,6 +388,10 @@ func moduleUnhealthyObservation(module, node string, rs []inventory.ResourceHeal // reasonWords is why a resource is unhealthy, as a person reads it. func reasonWords(r inventory.ResourceHealth) string { + // An account waiting for a new login (ADR 0252) is said in the mesh's words, not the engine's. + if r.Kind == link.KindAccount && strings.HasPrefix(r.Reason, link.ReasonRelogin) { + return fmt.Sprintf("waits for a new login of %s, which is in the group and logged in before it was", accountOf(r)) + } switch r.Reason { case "restarting": return fmt.Sprintf("keeps restarting (%d restart(s) counted)", r.Restarts) @@ -452,11 +456,11 @@ func personWait(module, machine string, rs []inventory.ResourceHealth) (string, } } said := fmt.Sprintf("relogin needed on %s: %s waits for a new login of %s, which is in its group and whose "+ - "running session began before it was; log out of every session and in again, or reboot", machine, module, + "login began before it was; log out of %[1]s completely and log in again, or restart it", machine, module, strings.Join(accounts, ", ")) if len(units) > 0 { sort.Strings(units) - said += fmt.Sprintf(" (until then %s cannot run in that session)", strings.Join(units, ", ")) + said += fmt.Sprintf(" (until then %s cannot run)", strings.Join(units, ", ")) } return said, true } diff --git a/cmd/mesh-controller/plain_words.go b/cmd/mesh-controller/plain_words.go index 40fb6898..54befa7f 100644 --- a/cmd/mesh-controller/plain_words.go +++ b/cmd/mesh-controller/plain_words.go @@ -672,7 +672,7 @@ const FromMeshMCPServer = "from the mesh MCP server; this notification cannot do // reloginNeeds is what an account waiting for its groups needs (ADR 0252). func reloginNeeds(node string) string { - return fmt.Sprintf("log out of every session on %s and log in again.", node) + return fmt.Sprintf("log out of %s completely and log in again, or restart it.", node) } // stalledWords are the plain words of a delivery held past its bound, as mesh-delivery says it. diff --git a/cmd/mesh-controller/plain_words_test.go b/cmd/mesh-controller/plain_words_test.go index abb8355e..a24290df 100644 --- a/cmd/mesh-controller/plain_words_test.go +++ b/cmd/mesh-controller/plain_words_test.go @@ -94,7 +94,7 @@ func TestAModuleUnhealthyAsksForARestartInWords(t *testing.T) { // An account waiting for a new login (ADR 0252) asks for the login, held to the plain rule. o = moduleUnhealthyObservation("openrazer", "g14", []inventory.ResourceHealth{{Kind: "account", Resource: "operator-in-group", Target: "jochen", Reason: "relogin needed: the account is in the group"}}) - if o.Needs != "log out of every session on g14 and log in again." || len(o.Actions) != 0 { + if o.Needs != "log out of g14 completely and log in again, or restart it." || len(o.Actions) != 0 { t.Errorf("relogin: %q %+v", o.Needs, o.Actions) } w := conditions.Words{Headline: o.Headline, Explanation: o.Explanation, Resolved: o.Resolved, Needs: o.Needs} @@ -107,6 +107,9 @@ func TestAModuleUnhealthyAsksForARestartInWords(t *testing.T) { if why, ok := conditions.PlainWords(rw, "g14"); !ok || rw.Needs == "" || len(rw.Actions) != 0 { t.Errorf("relogin-needed: %s %+v", why, rw) } + if strings.Contains(o.Summary, "session") || !strings.Contains(o.Summary, "waits for a new login of jochen") { + t.Errorf("relogin summary: %q", o.Summary) + } } // **Failed units on a machine**: "shanks's service manager is degraded: 3 failed unit(s) no module places —