From c3a73f2b2854bd0829cb0ca0f274e683f233eb36 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Sun, 11 Jul 2021 16:18:11 +0200 Subject: [PATCH] Filter only spoc apps in all app status --- src/spoc/podman.py | 6 +++--- tests/test_podman.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/spoc/podman.py b/src/spoc/podman.py index 1f74c1c..0f7246d 100644 --- a/src/spoc/podman.py +++ b/src/spoc/podman.py @@ -35,10 +35,10 @@ def stop_pod(app_name): run(['podman', 'pod', 'stop', '--ignore', app_name]) def get_pod_status(app_name=None): - cmd = ['podman', 'pod', 'ps'] + app_filter = 'label=spoc.app' if app_name: - cmd.extend(['--filter', f'label=spoc.app={app_name}']) - return out(cmd) + app_filter = f'{app_filter}={app_name}' + return out(['podman', 'pod', 'ps', '--filter', app_filter]) def create_volume(app_name, vol_name): run(['podman', 'volume', 'create', '--label', f'spoc.app={app_name}', vol_name]) diff --git a/tests/test_podman.py b/tests/test_podman.py index 5506a33..bb5dc7f 100644 --- a/tests/test_podman.py +++ b/tests/test_podman.py @@ -73,7 +73,7 @@ def test_get_pod_status_all(out): out.return_value = 'RESULT' status = podman.get_pod_status() - expected_cmd = ['podman', 'pod', 'ps'] + expected_cmd = ['podman', 'pod', 'ps', '--filter', 'label=spoc.app'] out.assert_called_once_with(expected_cmd) assert status == 'RESULT'