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'