Skip to content

Commit

Permalink
Fix type check error in DbtKubernetesBaseOperator.build_env_args (#766
Browse files Browse the repository at this point in the history
)

The imported function
`airflow.providers.cncf.kubernetes.backcompat.backwards_compat_converters.convert_env_vars`
was recently updated with type hints and can only accept dictionaries of
type `dict[str, str]`. The fix in this PR is to ensure the env var
values are strings.

Closes #765
  • Loading branch information
jbandoro authored Dec 13, 2023
1 parent e4278c6 commit 3d86cdb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cosmos/operators/kubernetes.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,12 @@ def __init__(self, profile_config: ProfileConfig | None = None, **kwargs: Any) -
def build_env_args(self, env: dict[str, str | bytes | PathLike[Any]]) -> None:
env_vars_dict: dict[str, str] = dict()

for env_var_key, env_var_value in env.items():
env_vars_dict[env_var_key] = str(env_var_value)
for env_var in self.env_vars:
env_vars_dict[env_var.name] = env_var.value

self.env_vars: list[Any] = convert_env_vars({**env, **env_vars_dict})
self.env_vars: list[Any] = convert_env_vars(env_vars_dict)

def build_and_run_cmd(self, context: Context, cmd_flags: list[str] | None = None) -> Any:
self.build_kube_args(context, cmd_flags)
Expand Down

0 comments on commit 3d86cdb

Please sign in to comment.