Skip to content

Commit

Permalink
restore convert_config_file_to_dict method and deprecate it
Browse files Browse the repository at this point in the history
  • Loading branch information
hussein-awala committed Apr 18, 2023
1 parent 24885c6 commit 5bc37f2
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions airflow/providers/cncf/kubernetes/operators/pod.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import json
import logging
import os
import re
import secrets
import string
Expand Down Expand Up @@ -360,6 +361,7 @@ def __init__(
self.deferrable = deferrable
self.poll_interval = poll_interval
self.remote_pod: k8s.V1Pod | None = None
self._config_dict: dict | None = None # TODO: remove it when removing convert_config_file_to_dict

@cached_property
def _incluster_namespace(self):
Expand Down Expand Up @@ -559,6 +561,20 @@ def execute_async(self, context: Context):
)
self.invoke_defer_method()

def convert_config_file_to_dict(self):
"""Converts passed config_file to dict format."""
warnings.warn(
"This method is deprecated and will be removed in a future version.",
DeprecationWarning,
stacklevel=2,
)
config_file = self.config_file if self.config_file else os.environ.get(KUBE_CONFIG_ENV_VAR)
if config_file:
with open(config_file) as f:
self._config_dict = yaml.safe_load(f)
else:
self._config_dict = None

def invoke_defer_method(self):
"""Method to easily redefine triggers which are being used in child classes."""
trigger_start_time = utcnow()
Expand Down

0 comments on commit 5bc37f2

Please sign in to comment.