aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordiogo464 <[email protected]>2025-07-17 14:51:03 +0100
committerdiogo464 <[email protected]>2025-07-17 14:51:03 +0100
commit032d9362819d7dfc24741dff78d4cb8a70531777 (patch)
tree240d1bd9f55e784eccde7bb9350bc7945eaed8bd
parent4d1551b70e690d18d1b0ffc625639b824c6a2670 (diff)
fixed address listing on machines with no addresses
currently the shell script used to list 10.0.0.0/8 range of addresses on a machine would fail with exit code 1 if no addresses were present in that range (i.e. grep did not match anything). this fix just makes sure that command always returns exit code 0.
-rw-r--r--src/main.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index aa673cb..9b9c815 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -658,7 +658,7 @@ async fn machines_configure(ctx: &Context, configs: &[MachineConfig]) -> Result<
658async fn machine_list_addresses(ctx: &Context, machine: Machine) -> Result<Vec<Ipv4Addr>> { 658async fn machine_list_addresses(ctx: &Context, machine: Machine) -> Result<Vec<Ipv4Addr>> {
659 tracing::info!("listing machine addresses"); 659 tracing::info!("listing machine addresses");
660 let interface = machine.interface(); 660 let interface = machine.interface();
661 let script = format!("ip addr show {interface} | grep -oE '10\\.[0-9]+\\.[0-9]+\\.[0-9]+'"); 661 let script = format!("ip addr show {interface} | grep -oE '10\\.[0-9]+\\.[0-9]+\\.[0-9]+' || true");
662 let output = machine_run_script(ctx, machine, &script).await?; 662 let output = machine_run_script(ctx, machine, &script).await?;
663 let stdout = std::str::from_utf8(&output.stdout)?; 663 let stdout = std::str::from_utf8(&output.stdout)?;
664 let mut addresses = Vec::default(); 664 let mut addresses = Vec::default();