This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 5d2296becb Fix Amazon EKS example DAG raises warning during Imports 
(#23849)
5d2296becb is described below

commit 5d2296becb9401df6ca58bb7d15d6655eb168aed
Author: Vedant Bhamare <[email protected]>
AuthorDate: Sun May 22 19:55:20 2022 +0530

    Fix Amazon EKS example DAG raises warning during Imports (#23849)
    
    
    Co-authored-by: eladkal <[email protected]>
---
 airflow/providers/amazon/aws/operators/eks.py | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/airflow/providers/amazon/aws/operators/eks.py 
b/airflow/providers/amazon/aws/operators/eks.py
index ef40cab2e1..600c4d3aa1 100644
--- a/airflow/providers/amazon/aws/operators/eks.py
+++ b/airflow/providers/amazon/aws/operators/eks.py
@@ -275,23 +275,23 @@ class EksCreateNodegroupOperator(BaseOperator):
         self.create_nodegroup_kwargs = create_nodegroup_kwargs or {}
         self.aws_conn_id = aws_conn_id
         self.region = region
-        nodegroup_subnets_list: List[str] = []
-        if isinstance(nodegroup_subnets, str):
-            if nodegroup_subnets != "":
+        self.nodegroup_subnets = nodegroup_subnets
+        super().__init__(**kwargs)
+
+    def execute(self, context: 'Context'):
+        if isinstance(self.nodegroup_subnets, str):
+            nodegroup_subnets_list: List[str] = []
+            if self.nodegroup_subnets != "":
                 try:
-                    nodegroup_subnets_list = cast(List, 
literal_eval(nodegroup_subnets))
+                    nodegroup_subnets_list = cast(List, 
literal_eval(self.nodegroup_subnets))
                 except ValueError:
                     self.log.warning(
                         "The nodegroup_subnets should be List or string 
representing "
                         "Python list and is %s. Defaulting to []",
-                        nodegroup_subnets,
+                        self.nodegroup_subnets,
                     )
-        else:
-            nodegroup_subnets_list = nodegroup_subnets
-        self.nodegroup_subnets = nodegroup_subnets_list
-        super().__init__(**kwargs)
+            self.nodegroup_subnets = nodegroup_subnets_list
 
-    def execute(self, context: 'Context'):
         eks_hook = EksHook(
             aws_conn_id=self.aws_conn_id,
             region_name=self.region,

Reply via email to