brokerd: escape container errors in the log; prefix and quote two messages

Implemented-By: OpenCode session (model recorded in docs/implementer-log.md)
This commit is contained in:
2026-09-23 16:10:54 -07:00
parent 93539dbead
commit e69ba632e6
6 changed files with 220 additions and 7 deletions
+2 -2
View File
@@ -176,7 +176,7 @@ impl Config {
}
if let Some(runner) = &config.runner {
let where_image = format!(
"[runner] image is {}; it must be named by digest: <name>@sha256:<64 hex digits>",
"[runner] image is {:?}; it must be named by digest: <name>@sha256:<64 hex digits>",
runner.image
);
let (name, hex) = match runner.image.rsplit_once("@sha256:") {
@@ -198,7 +198,7 @@ impl Config {
return Err(ConfigError::Invalid(
path.to_path_buf(),
format!(
"[runner] memory is {}; it must be a number and one of b, k, m, g",
"[runner] memory is {:?}; it must be a number and one of b, k, m, g",
runner.memory
),
));
+8 -4
View File
@@ -214,16 +214,20 @@ impl Podman {
truncated,
}),
Some(2) => {
(self.log)(err);
(self.log)(&format!("brokerd: {name}: the tool could not run: {err:?}"));
Err(RunError::Failed(COULD_NOT_RUN.to_string()))
}
Some(125..=127) => {
(self.log)(&format!("{err}\n{RUNBOOK}"));
(self.log)(&format!(
"brokerd: podman could not start {name}: {err:?}\n{RUNBOOK}"
));
Err(RunError::Unavailable(CANNOT_START.to_string()))
}
Some(137) => Err(RunError::Failed(KILLED.to_string())),
_ => {
(self.log)(&format!("brokerd: container {name} exited {status}\n{err}"));
(self.log)(&format!(
"brokerd: container {name} exited {status}: {err:?}"
));
Err(RunError::Failed(UNEXPECTED.to_string()))
}
},
@@ -302,7 +306,7 @@ impl Podman {
Ok(output) => {
let stderr = String::from_utf8_lossy(&output.stderr).into_owned();
(self.log)(&format!(
"brokerd: podman could not start {name}-egress: {stderr}\n{RUNBOOK}"
"brokerd: podman could not start {name}-egress: {stderr:?}\n{RUNBOOK}"
));
return Err(RunError::Unavailable(CANNOT_START.to_string()));
}
+1 -1
View File
@@ -97,7 +97,7 @@ fn main() -> ExitCode {
broker_path.display(),
admin_path.display()
);
eprintln!("{runtime_notice}");
eprintln!("brokerd: {runtime_notice}");
match started.run() {
Ok(()) => ExitCode::SUCCESS,