Skip to content

Commit

Permalink
BugFix: Using json string in template_field causes issue with K8s O…
Browse files Browse the repository at this point in the history
…perators (#16930)

closes apache/airflow#16922

Because we simply check if fields in template_field ends with `template_ext`,
this was causing issues if the str ends with json, in which case Airflow would
try to search for file instead of using the string

GitOrigin-RevId: b2c66e45b7c27d187491ec6a1dd5cc92ac7a1e32
  • Loading branch information
kaxil authored and Cloud Composer Team committed Aug 27, 2022
1 parent cf7fd8f commit d3dcbf9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ class KubernetesPodOperator(BaseOperator):
'pod_template_file',
)

template_ext = ('yaml', 'yml', 'json')
template_ext = ('.yaml', '.yml', '.json')

# fmt: off
def __init__(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class SparkKubernetesOperator(BaseOperator):
"""

template_fields = ['application_file', 'namespace']
template_ext = ('yaml', 'yml', 'json')
template_ext = ('.yaml', '.yml', '.json')
ui_color = '#f4a460'

def __init__(
Expand Down

0 comments on commit d3dcbf9

Please sign in to comment.