mirror of
https://github.com/ansible-collections/community.docker.git
synced 2025-12-18 12:52:37 +00:00
Fix EndpointSpec KeyError. (#637)
This commit is contained in:
parent
74b70f81c8
commit
748d619fb2
2
changelogs/fragments/637-swarm_info-endpoint_spec.yml
Normal file
2
changelogs/fragments/637-swarm_info-endpoint_spec.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
bugfixes:
|
||||||
|
- "docker_swarm_info - if ``service=true`` is used, do not crash when a service without an endpoint spec is encountered (https://github.com/ansible-collections/community.docker/issues/636, https://github.com/ansible-collections/community.docker/pull/637)."
|
||||||
@ -326,7 +326,7 @@ class DockerSwarmManager(DockerBaseClass):
|
|||||||
# Number of replicas have to be updated in calling method or may be left as None
|
# Number of replicas have to be updated in calling method or may be left as None
|
||||||
object_essentials['Replicas'] = None
|
object_essentials['Replicas'] = None
|
||||||
object_essentials['Image'] = item['Spec']['TaskTemplate']['ContainerSpec']['Image']
|
object_essentials['Image'] = item['Spec']['TaskTemplate']['ContainerSpec']['Image']
|
||||||
if 'Ports' in item['Spec']['EndpointSpec']:
|
if item['Spec'].get('EndpointSpec') and 'Ports' in item['Spec']['EndpointSpec']:
|
||||||
object_essentials['Ports'] = item['Spec']['EndpointSpec']['Ports']
|
object_essentials['Ports'] = item['Spec']['EndpointSpec']['Ports']
|
||||||
else:
|
else:
|
||||||
object_essentials['Ports'] = []
|
object_essentials['Ports'] = []
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user