barrywhart commented on code in PR #25829:
URL: https://github.com/apache/airflow/pull/25829#discussion_r952640723


##########
airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py:
##########
@@ -409,6 +425,12 @@ def extract_xcom(self, pod: k8s.V1Pod):
             self.log.info("xcom result: \n%s", result)
             return json.loads(result)
 
+    def pre_execute(self, context):
+        if isinstance(self.env_vars, str):
+            self.env_vars = 
convert_env_vars(ast.literal_eval(self.env_vars.strip()))

Review Comment:
   At this point, assuming Jinja templating was used, it's a string rendered by 
Jinja. In order for this to work correctly with `convert_env_vars()`, it needs 
to be a Python dictionary literal. (While `convert_env_vars()` supports `list`, 
apparently that requires the list items to _already_ be instances of 
`V1EnvVar`.) If supporting `list` output from Jinja seems useful, I think that 
would be a straightforward addition to this PR.
   
   Example value:
   ```
   "{'foo1': 'bar1', 'foo2': 'bar2', 'run_id': 
'manual__2016-01-01T01:00:00+01:00'}"
   ```
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to