Say the terminal explicitly, only from a login session, and name the unannounced pull request (hq ADR 0272)
- commandEnvironment takes the terminal as a bool instead of reading an empty verb as one; every non-terminal line names its verb and is stripped of MESH_CLI_TERMINAL, and a test with the mark set in the serving environment fails when that strip is taken out. - On the control-node the operator's account is the terminal only from a login session, as the node-engine reads it from the kernel's cgroup; the tool runner and the account's user units run as the operator too, and are ordinary calls. The request carries `session` (field-name tests on both sides). - A pull request the forge never announced is named with its number in the condition's headline (hq issue 347), from the stalled line's `number`, which mesh-delivery sends.
This commit is contained in:
@@ -931,27 +931,26 @@ func isWhyFlag(word string) bool {
|
||||
|
||||
// commandEnvironment is the environment of a command line this controller runs for someone: its own — the
|
||||
// stores' credentials, the bus, the broker, everything a command run from a shell beside it would have, because it
|
||||
// is that — with who asked, and the verb it came through. An empty verb is the controller's terminal (novox/hq ADR
|
||||
// 0272 §4): no `MESH_VERB` at all, whatever this process was started with.
|
||||
// is that — with who asked, and how it came.
|
||||
//
|
||||
// The terminal's line is also not the serving controller's (servedVar), and carries cliTerminalVar, so what reads
|
||||
// whether it was started at the terminal (startedAtTheTerminal) reads yes; every other line is stripped of that mark.
|
||||
func commandEnvironment(caller, verb string) []string {
|
||||
// **terminal** is said, never inferred (novox/hq ADR 0272): only a line mesh-cli asked as the controller's terminal
|
||||
// passes true. Its line has no `MESH_VERB`, not the served mark ADR 0266 puts on everything the serving controller
|
||||
// starts, and the terminal's mark (cliTerminalVar), so startedAtTheTerminal reads yes. Every other line names its
|
||||
// verb, and is stripped of the terminal's mark whatever this process's environment holds.
|
||||
func commandEnvironment(caller, verb string, terminal bool) []string {
|
||||
env := make([]string, 0, len(os.Environ())+3)
|
||||
for _, kv := range os.Environ() {
|
||||
if strings.HasPrefix(kv, verbVar+"=") || strings.HasPrefix(kv, link.CallerVar+"=") ||
|
||||
strings.HasPrefix(kv, cliTerminalVar+"=") || (verb == "" && strings.HasPrefix(kv, servedVar+"=")) {
|
||||
strings.HasPrefix(kv, cliTerminalVar+"=") || (terminal && strings.HasPrefix(kv, servedVar+"=")) {
|
||||
continue
|
||||
}
|
||||
env = append(env, kv)
|
||||
}
|
||||
env = append(env, link.CallerVar+"="+caller)
|
||||
if verb != "" {
|
||||
env = append(env, verbVar+"="+verb)
|
||||
} else {
|
||||
env = append(env, cliTerminalVar+"=1")
|
||||
if terminal {
|
||||
return append(env, cliTerminalVar+"=1")
|
||||
}
|
||||
return env
|
||||
return append(env, verbVar+"="+verb)
|
||||
}
|
||||
|
||||
// runVerb runs this binary with the given command line and gathers what it said.
|
||||
@@ -977,7 +976,7 @@ func runVerb(ctx context.Context, argv []string) (verbAnswer, error) {
|
||||
if verb == "" {
|
||||
verb = argv[0]
|
||||
}
|
||||
cmd.Env = commandEnvironment(caller+", through the "+catalogue.ControllerSeatName+" seat", verb)
|
||||
cmd.Env = commandEnvironment(caller+", through the "+catalogue.ControllerSeatName+" seat", verb, false)
|
||||
// Two buffers, one answer. What the command *says* is both streams, in the order a person at
|
||||
// a shell would read them; what it *answers as data* is standard output alone — `status --json`
|
||||
// prints its warnings beside the document, and a JSON parsed from the two together parsed
|
||||
|
||||
Reference in New Issue
Block a user