mirror of
https://github.com/robcholz/vibebox.git
synced 2026-10-09 01:01:13 +02:00
feat: added provision error propagation
This commit is contained in:
1 parent
b425ae4b77
commit
b5cd1f2064
3 files changed
+18
-2
No files matched your search
+8
-2
@@ -120,9 +120,15 @@ fn main() -> Result<()> {
|
|||||||
tracing::debug!(auto_shutdown_ms, "auto shutdown config");
|
tracing::debug!(auto_shutdown_ms, "auto shutdown config");
|
||||||
let manager_conn =
|
let manager_conn =
|
||||||
vm_manager::ensure_manager(&raw_args, auto_shutdown_ms, config_override.as_deref())
|
vm_manager::ensure_manager(&raw_args, auto_shutdown_ms, config_override.as_deref())
|
||||||
.map_err(|err| color_eyre::eyre::eyre!(err.to_string()))?;
|
.map_err(|err| {
|
||||||
|
tracing::error!(error = %err, "failed to ensure vm manager");
|
||||||
|
color_eyre::eyre::eyre!(err.to_string())
|
||||||
|
})?;
|
||||||
|
|
||||||
instance::run_with_ssh(manager_conn).map_err(|err| color_eyre::eyre::eyre!(err.to_string()))?;
|
instance::run_with_ssh(manager_conn).map_err(|err| {
|
||||||
|
tracing::error!(error = %err, "failed to ensure vm manager");
|
||||||
|
color_eyre::eyre::eyre!(err.to_string())
|
||||||
|
})?;
|
||||||
|
|
||||||
tracing::info!("See you again — keep vibecoding (no SEVs, only vibes) 😈");
|
tracing::info!("See you again — keep vibecoding (no SEVs, only vibes) 😈");
|
||||||
|
|
||||||
|
|||||||
@@ -266,6 +266,11 @@ fn wait_for_vm_ipv4(
|
|||||||
Ok(status) => {
|
Ok(status) => {
|
||||||
status_missing = false;
|
status_missing = false;
|
||||||
let status = status.trim().to_string();
|
let status = status.trim().to_string();
|
||||||
|
if status.starts_with("error:") {
|
||||||
|
let _ = fs::remove_file(&status_path);
|
||||||
|
let message = status.trim_start_matches("error:").trim().to_string();
|
||||||
|
return Err(message.into());
|
||||||
|
}
|
||||||
if !status.is_empty() && last_status.as_deref() != Some(status.as_str()) {
|
if !status.is_empty() && last_status.as_deref() != Some(status.as_str()) {
|
||||||
tracing::info!("[background]: {}", status);
|
tracing::info!("[background]: {}", status);
|
||||||
last_status = Some(status);
|
last_status = Some(status);
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ use std::{
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
config::CONFIG_PATH_ENV,
|
config::CONFIG_PATH_ENV,
|
||||||
|
instance::STATUS_FILE_NAME,
|
||||||
instance::VM_ROOT_LOG_NAME,
|
instance::VM_ROOT_LOG_NAME,
|
||||||
instance::{
|
instance::{
|
||||||
DEFAULT_SSH_USER, InstanceConfig, build_ssh_login_actions, ensure_instance_dir,
|
DEFAULT_SSH_USER, InstanceConfig, build_ssh_login_actions, ensure_instance_dir,
|
||||||
@@ -765,6 +766,10 @@ fn run_manager_with(
|
|||||||
);
|
);
|
||||||
tracing::info!("vm manager vm run completed");
|
tracing::info!("vm manager vm run completed");
|
||||||
let vm_err = vm_result.err().map(|e| e.to_string());
|
let vm_err = vm_result.err().map(|e| e.to_string());
|
||||||
|
if let Some(err) = &vm_err {
|
||||||
|
let status_path = instance_dir.join(STATUS_FILE_NAME);
|
||||||
|
let _ = fs::write(&status_path, format!("error: {err}"));
|
||||||
|
}
|
||||||
let _ = event_tx.send(ManagerEvent::VmExited(vm_err.clone()));
|
let _ = event_tx.send(ManagerEvent::VmExited(vm_err.clone()));
|
||||||
let event_loop_result: Result<(), String> = event_loop_handle
|
let event_loop_result: Result<(), String> = event_loop_handle
|
||||||
.join()
|
.join()
|
||||||
|
|||||||
Reference in new issue
Block a user