From 981fae133a5670d4b3d2767212bd0d41c1b3b413 Mon Sep 17 00:00:00 2001 From: hussein-awala Date: Thu, 30 Nov 2023 23:02:58 +0200 Subject: [PATCH] Fix a bug with accessing hooks in EKS trigger --- airflow/providers/amazon/aws/triggers/eks.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/airflow/providers/amazon/aws/triggers/eks.py b/airflow/providers/amazon/aws/triggers/eks.py index 5a48ee39c0758..eb496acff83a7 100644 --- a/airflow/providers/amazon/aws/triggers/eks.py +++ b/airflow/providers/amazon/aws/triggers/eks.py @@ -120,7 +120,7 @@ def hook(self) -> AwsGenericHook: return EksHook(aws_conn_id=self.aws_conn_id, region_name=self.region_name) async def run(self): - async with self.hook.async_conn as client: + async with self.hook().async_conn as client: waiter = client.get_waiter("cluster_deleted") if self.force_delete_compute: await self.delete_any_nodegroups(client=client) @@ -148,10 +148,7 @@ async def delete_any_nodegroups(self, client) -> None: nodegroups = await client.list_nodegroups(clusterName=self.cluster_name) if nodegroups.get("nodegroups", None): self.log.info("Deleting nodegroups") - # ignoring attr-defined here because aws_base hook defines get_waiter for all hooks - waiter = self.hook.get_waiter( # type: ignore[attr-defined] - "all_nodegroups_deleted", deferrable=True, client=client - ) + waiter = self.hook().get_waiter("all_nodegroups_deleted", deferrable=True, client=client) for group in nodegroups["nodegroups"]: await client.delete_nodegroup(clusterName=self.cluster_name, nodegroupName=group) await async_wait(