From e50eefc21c15078cde6147167e735a0b58d8dba7 Mon Sep 17 00:00:00 2001 From: Shay Pletcher <4468322+ThePletch@users.noreply.github.com> Date: Sun, 24 Dec 2023 09:29:02 -0500 Subject: [PATCH] Handle precreated ENIs in service discovery lambda --- infrastructure/lambda/service-discovery.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/infrastructure/lambda/service-discovery.py b/infrastructure/lambda/service-discovery.py index 90775e7..f5e8b82 100644 --- a/infrastructure/lambda/service-discovery.py +++ b/infrastructure/lambda/service-discovery.py @@ -23,10 +23,10 @@ def get_eni_ip(event): attachment for attachment in event['detail']['attachments'] - if attachment['type'] == 'eni' + if attachment['type'] == 'eni' and attachment['status'] != 'PRECREATED' ) except StopIteration: - print("No ENI attached to this task. Nothing to do.") + print("No non-precreated ENI attached to this task. Nothing to do.") return False try: @@ -37,7 +37,7 @@ def get_eni_ip(event): if detail['name'] == 'networkInterfaceId' )['value'] except StopIteration: - print(eni_attachment['details']) + print(event) raise RuntimeError("No network interface ID listed for this ENI somehow.") enis = client_ec2.describe_network_interfaces(NetworkInterfaceIds=[eni_id])['NetworkInterfaces']