Skip to content

Commit

Permalink
Prevent crash if Mode isn't present, which happens for Swarm jobs. (#…
Browse files Browse the repository at this point in the history
…1003)

(cherry picked from commit 7583ea8)
  • Loading branch information
felixfontein authored and patchback[bot] committed Dec 4, 2024
1 parent 29c586c commit 3ccc156
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
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

0 comments on commit 3ccc156

Please sign in to comment.