From 4e884d9ecce90e262ea2a8dd6fa53f6d5dce011e Mon Sep 17 00:00:00 2001 From: Gabor Javorszky Date: Fri, 17 May 2024 11:23:47 +0100 Subject: tools/unitctl: Replace matching image name to matching command Closes #1254 Matching to the `unitd` command is a far more reliable way to filtering docker instances that are running Unit. --- tools/unitctl/unit-client-rs/src/unitd_docker.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/unitctl/unit-client-rs/src/unitd_docker.rs b/tools/unitctl/unit-client-rs/src/unitd_docker.rs index b9199e40..6881893d 100644 --- a/tools/unitctl/unit-client-rs/src/unitd_docker.rs +++ b/tools/unitctl/unit-client-rs/src/unitd_docker.rs @@ -151,13 +151,14 @@ impl UnitdContainer { vec![] } Ok(summary) => { + let unitd_command_re = Regex::new(r"^(.* )?unitd( .*)?$").unwrap(); + // cant do this functionally because of the async call let mut mapped = vec![]; for ctr in summary { - if ctr.clone().image + if unitd_command_re.is_match(&ctr.clone().command .or(Some(String::new())) - .unwrap() - .contains("unit") { + .unwrap()) { let mut c = UnitdContainer::from(&ctr); if let Some(names) = ctr.names { if names.len() > 0 { -- cgit