Fix EndpointSpec KeyError. (#637)

This commit is contained in:
Felix Fontein
2023-05-26 17:58:09 +02:00
committed by GitHub
parent 74b70f81c8
commit 748d619fb2
2 changed files with 3 additions and 1 deletions
+1 -1
View File
@@ -326,7 +326,7 @@ class DockerSwarmManager(DockerBaseClass):
# Number of replicas have to be updated in calling method or may be left as None
object_essentials['Replicas'] = None
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']
else:
object_essentials['Ports'] = []