Do not fail on non-fatal errors. (#810)

This commit is contained in:
Felix Fontein 2024-02-28 21:43:30 +01:00 committed by GitHub
parent d4b654793e
commit 37e28b62d3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View File

@ -0,0 +1,4 @@
bugfixes:
- "docker_compose_v2 - do not fail when non-fatal errors occur. This can happen when pulling an image fails, but then the image can be built
for another service. Docker Compose emits an error in that case, but ``docker compose up`` still completes successfully
(https://github.com/ansible-collections/community.docker/issues/807, https://github.com/ansible-collections/community.docker/pull/810)."

View File

@ -404,6 +404,8 @@ def is_failed(events, rc):
def update_failed(result, events, args, stdout, stderr, rc, cli): def update_failed(result, events, args, stdout, stderr, rc, cli):
if not rc:
return False
errors = [] errors = []
for event in events: for event in events:
if event.status in DOCKER_STATUS_ERROR: if event.status in DOCKER_STATUS_ERROR:
@ -419,8 +421,6 @@ def update_failed(result, events, args, stdout, stderr, rc, cli):
status=event.status, status=event.status,
msg=event.msg, msg=event.msg,
)) ))
if not errors and not rc:
return False
if not errors: if not errors:
errors.append('Return code {code} is non-zero'.format(code=rc)) errors.append('Return code {code} is non-zero'.format(code=rc))
result['failed'] = True result['failed'] = True