diff --git a/changelogs/fragments/916-compose-v2-parse.yml b/changelogs/fragments/916-compose-v2-parse.yml new file mode 100644 index 000000000..eecc7fd1b --- /dev/null +++ b/changelogs/fragments/916-compose-v2-parse.yml @@ -0,0 +1,2 @@ +bugfixes: + - "docker_compose_v2* modules - fix parsing of skipped pull messages for Docker Compose 2.28.x (https://github.com/ansible-collections/community.docker/issues/911, https://github.com/ansible-collections/community.docker/pull/916)." diff --git a/plugins/module_utils/compose_v2.py b/plugins/module_utils/compose_v2.py index 80d6be66f..0c7e79b03 100644 --- a/plugins/module_utils/compose_v2.py +++ b/plugins/module_utils/compose_v2.py @@ -202,9 +202,9 @@ def from_docker_compose_event(cls, resource_type): r'\s*' r'(?P\S+)' r'\s+' - r'Skipped -' + r'Skipped(?: -' r'\s*' - r'(?P\S(?:|.*\S))' + r'(?P\S(?:|.*\S))|\s*)' r'$' ) diff --git a/tests/unit/plugins/module_utils/test_compose_v2.py b/tests/unit/plugins/module_utils/test_compose_v2.py index 7292af2a7..9ecbf0be9 100644 --- a/tests/unit/plugins/module_utils/test_compose_v2.py +++ b/tests/unit/plugins/module_utils/test_compose_v2.py @@ -217,6 +217,36 @@ 'dummy4: Foo bar', ], ), + ( + # https://github.com/ansible-collections/community.docker/issues/911 + '2.28.1-image-pull-skipped', + '2.28.1', + False, + " bash_1 Skipped \n" + " bash_2 Pulling \n" + " bash_2 Pulled \n", + [ + Event( + 'unknown', + 'bash_1', + 'Skipped', + None, + ), + Event( + 'service', + 'bash_2', + 'Pulling', + None, + ), + Event( + 'service', + 'bash_2', + 'Pulled', + None, + ), + ], + [], + ), ] _ALL_TEST_CASES = EVENT_TEST_CASES + EXTRA_TEST_CASES