File tree Expand file tree Collapse file tree 1 file changed +6
-10
lines changed
airflow/providers/cncf/kubernetes/backcompat Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -71,19 +71,15 @@ def convert_port(port) -> k8s.V1ContainerPort:
71
71
72
72
def convert_env_vars (env_vars : list [k8s .V1EnvVar ] | dict [str , str ]) -> list [k8s .V1EnvVar ]:
73
73
"""
74
- Convert a dictionary into a list of env_vars .
74
+ Coerce env var collection for kubernetes .
75
75
76
- :param env_vars:
76
+ If the collection is a str-str dict, convert it into a list of ``V1EnvVar``s.
77
77
"""
78
- if isinstance (env_vars , dict ):
79
- res = []
80
- for k , v in env_vars .items ():
81
- res .append (k8s .V1EnvVar (name = k , value = v ))
82
- return res
83
- elif isinstance (env_vars , list ):
78
+ if isinstance (env_vars , list ):
84
79
return env_vars
85
- else :
86
- raise AirflowException (f"Expected dict or list, got { type (env_vars )} " )
80
+ if isinstance (env_vars , dict ):
81
+ return [k8s .V1EnvVar (name = k , value = v ) for k , v in env_vars .items ()]
82
+ raise AirflowException (f"Expected dict or list, got { type (env_vars )} " )
87
83
88
84
89
85
def convert_pod_runtime_info_env (pod_runtime_info_envs ) -> k8s .V1EnvVar :
You can’t perform that action at this time.
0 commit comments