fix(702): narrow SystemdRunMachine to ReloadGatewayNginx in hive-priv

This commit is contained in:
damocles 2026-06-01 16:47:28 +02:00 committed by mara
commit efedfc3ea6

View file

@ -243,25 +243,20 @@ async fn exec(req: PrivRequest) -> Result<(String, String)> {
Ok((String::new(), String::new()))
}
PrivRequest::SystemdRunMachine { ref machine, ref cmd } => {
validate_container_name(machine)?;
let mut args = vec!["--machine".to_owned(), machine.clone(), "--quiet".to_owned(), "--".to_owned()];
args.extend(cmd.iter().cloned());
PrivRequest::ReloadGatewayNginx => {
let out = Command::new("systemd-run")
.args(&args)
.args(["--machine=hive-gateway", "--quiet", "--", "nginx", "-s", "reload"])
.output()
.await
.context("invoke systemd-run")?;
let stdout = String::from_utf8_lossy(&out.stdout).into_owned();
let stderr = String::from_utf8_lossy(&out.stderr).into_owned();
.context("invoke systemd-run for gateway nginx reload")?;
if !out.status.success() {
bail!(
"systemd-run --machine={machine} failed ({}): {}",
"gateway nginx reload failed ({}): {}",
out.status,
stderr.trim()
String::from_utf8_lossy(&out.stderr).trim()
);
}
Ok((stdout, stderr))
Ok((String::new(), String::new()))
}
}
}