fix: make exec_in_container return errors instead of silently warning
- Changed from warn() to error() and return Err() - Added info logging for each command executed - Now we can see why downloads/installs fail
This commit is contained in:
parent
9a3ac6141e
commit
bc3b3845b4
2 changed files with 28 additions and 3 deletions
18
PROMPT.md
18
PROMPT.md
|
|
@ -5,6 +5,24 @@
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## Build Rules - IMPORTANT
|
||||||
|
|
||||||
|
**Always use debug builds during development and testing:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# CORRECT - debug build (fast compilation)
|
||||||
|
cargo build
|
||||||
|
cargo check
|
||||||
|
|
||||||
|
# WRONG - do NOT use release builds unless explicitly requested
|
||||||
|
# cargo build --release
|
||||||
|
```
|
||||||
|
|
||||||
|
Debug builds compile much faster and are sufficient for testing functionality.
|
||||||
|
Only use `--release` when building final binaries for deployment.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Weekly Maintenance - EVERY MONDAY
|
## Weekly Maintenance - EVERY MONDAY
|
||||||
|
|
||||||
### Package Review Checklist
|
### Package Review Checklist
|
||||||
|
|
|
||||||
|
|
@ -1028,14 +1028,21 @@ Store credentials in Vault:
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
pub fn exec_in_container(&self, container: &str, command: &str) -> Result<()> {
|
pub fn exec_in_container(&self, container: &str, command: &str) -> Result<()> {
|
||||||
|
info!("Executing in container {}: {}", container, command);
|
||||||
let output = Command::new("lxc")
|
let output = Command::new("lxc")
|
||||||
.args(&["exec", container, "--", "bash", "-c", command])
|
.args(&["exec", container, "--", "bash", "-c", command])
|
||||||
.output()?;
|
.output()?;
|
||||||
if !output.status.success() {
|
if !output.status.success() {
|
||||||
warn!(
|
let stderr = String::from_utf8_lossy(&output.stderr);
|
||||||
"Container command failed: {}",
|
let stdout = String::from_utf8_lossy(&output.stdout);
|
||||||
String::from_utf8_lossy(&output.stderr)
|
error!(
|
||||||
|
"Container command failed.\nCommand: {}\nStderr: {}\nStdout: {}",
|
||||||
|
command, stderr, stdout
|
||||||
);
|
);
|
||||||
|
return Err(anyhow::anyhow!(
|
||||||
|
"Container command failed: {}",
|
||||||
|
if stderr.is_empty() { stdout.to_string() } else { stderr.to_string() }
|
||||||
|
));
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue