summaryrefslogtreecommitdiffhomepage
path: root/tools/unitctl/unit-client-rs/src/unitd_docker.rs
diff options
context:
space:
mode:
authorGabor Javorszky <g.javorszky@f5.com>2024-05-17 11:23:47 +0100
committerGabor Javorszky <gabor@javorszky.co.uk>2024-05-20 16:58:33 +0100
commit4e884d9ecce90e262ea2a8dd6fa53f6d5dce011e (patch)
treeac54c623461f9f8c2f03b0bf7db915a7a1db3010 /tools/unitctl/unit-client-rs/src/unitd_docker.rs
parentc30c2f5e4218d8931b64d5e3d1cdabd9690e7720 (diff)
downloadunit-4e884d9ecce90e262ea2a8dd6fa53f6d5dce011e.tar.gz
unit-4e884d9ecce90e262ea2a8dd6fa53f6d5dce011e.tar.bz2
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.
Diffstat (limited to '')
-rw-r--r--tools/unitctl/unit-client-rs/src/unitd_docker.rs7
1 files 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 {