Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PR #1003/7583ea82 backport][stable-3] docker_swarm_info: prevent crash if Mode isn't present, which happens for Swarm jobs #1004

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/1003-docker_swarm_info-crash.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- "docker_swarm_info - do not crash when finding Swarm jobs if ``services=true`` (https://github.com/ansible-collections/community.docker/issues/1003)."
2 changes: 1 addition & 1 deletion plugins/modules/docker_swarm_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ def get_docker_items_list(self, docker_object=None, filters=None):
item_record = self.get_essential_facts_tasks(item)
elif docker_object == 'services':
item_record = self.get_essential_facts_services(item)
if item_record['Mode'] == 'Global':
if item_record.get('Mode') == 'Global':
item_record['Replicas'] = len(items)
items_list.append(item_record)

Expand Down
Loading