From 7f1b53a14bf98b242c353c352fff5e2fe01c2439 Mon Sep 17 00:00:00 2001 From: "John \"Preston\" Mille" Date: Wed, 24 Jan 2024 05:58:14 +0000 Subject: [PATCH] Catching exception in the exception --- ecs_composex/elbv2/elbv2_ecs.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ecs_composex/elbv2/elbv2_ecs.py b/ecs_composex/elbv2/elbv2_ecs.py index 64fc8c24..e2e50ec7 100644 --- a/ecs_composex/elbv2/elbv2_ecs.py +++ b/ecs_composex/elbv2/elbv2_ecs.py @@ -385,7 +385,11 @@ def validate_props_and_service_definition(props, service): raise ValueError( f"Defined TargetGroup port {props['Port']} is not defined for {service.name}." " Valid ports are", - [p["published"] for p in service.ports], + [ + _port["published"] + for _port in service.ports + if keyisset("published", _port) + ], ) chosen_port = [p for p in service.ports if p["target"] == props["Port"]] if (chosen_port[0]["protocol"] == "tcp" and props["Protocol"] not in valid_tcp) or (