Skip to content

Commit

Permalink
Use a single remote call when querying accelerators in stonith-lambda
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Emerson <[email protected]>
  • Loading branch information
ryanemerson authored and mhajas committed Aug 12, 2024
1 parent dd78da6 commit 2f94ada
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ def handle_site_offline(labels):
a_client = boto3.client('globalaccelerator', region_name='us-west-2')

acceleratorDNS = labels['accelerator']
accelerator = jmespath.search(f"Accelerators[?DnsName=='{acceleratorDNS}']", a_client.list_accelerators())
if not accelerator:
accelerator = jmespath.search(f"Accelerators[?DualStackDnsName=='{acceleratorDNS}']", a_client.list_accelerators())
accelerator = jmespath.search(f"Accelerators[?(DnsName=='{acceleratorDNS}'|| DualStackDnsName=='{acceleratorDNS}')]", a_client.list_accelerators())
if not accelerator:
print(f"Ignoring SiteOffline alert as accelerator with DnsName '{acceleratorDNS}' not found")
return
Expand Down

0 comments on commit 2f94ada

Please sign in to comment.