Skip to content

Fix template-field validation timing in ssh provider operators - #70315

Merged
shahar1 merged 10 commits into
apache:mainfrom
bramhanandlingala:fix/70296
Jul 25, 2026
Merged

Fix template-field validation timing in ssh provider operators#70315
shahar1 merged 10 commits into
apache:mainfrom
bramhanandlingala:fix/70296

Conversation

@bramhanandlingala

@bramhanandlingala bramhanandlingala commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Fixes the ssh provider's two entries from the #70296 exemption-list burn-down: SSHOperator and SSHRemoteJobOperator applied logic to template fields inside __init__, before Jinja templating runs.

  • SSHRemoteJobOperator: remote_base_dir was validated in __init__, against the raw un-rendered template string. Moved validation to execute().
  • SSHOperator: when a pre-built ssh_hook was injected, __init__ pushed the un-rendered remote_host onto it. Moved this to execute().

Both __init__ methods now only do plain assignments; the field-dependent logic runs in execute(), after templating.

Tests added for both operators covering the fixed behavior.

Related to #70296

Gen-AI disclosure: I used a generative AI tool to help identify the root
cause, write tests, and draft the PR description. I reviewed, tested, and
verified all changes locally before submitting.

Was generative AI tooling used to co-author this PR?
  • Yes — Claude

Generated-by: Claude following the guidelines

@shahar1 shahar1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution!

  1. Please fix static checks.
  2. Make sure to remove the operator from the txt file.

@bramhanandlingala

Copy link
Copy Markdown
Contributor Author

@shahar1

Thanks for the review!

Fixed the static check and removed both ssh entries from the exemption file. Let me know if anything else is needed.

Comment thread providers/ssh/src/airflow/providers/ssh/operators/ssh.py Outdated
@shahar1

shahar1 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

@bramhanandlingala noted an issue just before merging, please address this. Thank you! (please note that I merged main to your branch, so you might need to pull it first)

# Conflicts:
#	scripts/ci/prek/validate_operators_init_exemptions.txt
 into fix/70296

# Conflicts:
#	scripts/ci/prek/validate_operators_init_exemptions.txt
@bramhanandlingala

Copy link
Copy Markdown
Contributor Author

Thanks @shahar1! Fixed — switched to if self.remote_host: as suggested, and added tests covering both the init no-mutation case and the execute() templated-value case. Ready for re-review.

@shahar1

shahar1 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Thanks @shahar1! Fixed — switched to if self.remote_host: as suggested, and added tests covering both the init no-mutation case and the execute() templated-value case. Ready for re-review.

Please note that static checks currently fail

@bramhanandlingala

Copy link
Copy Markdown
Contributor Author

Thanks for flagging, @shahar1 ! Dug into it — the failure wasn't related to the SSH changes at all. It was a stale exemption entry: SnowparkContainerJobOperator had already been fixed and its exemption removed on main, but a stale copy of that entry survived in our branch's validate_operators_init_exemptions.txt through a few merge conflict resolutions. Removed it and pushed — all checks are passing now. Ready for re-review whenever you have a chance!

@shahar1
shahar1 dismissed their stale review July 25, 2026 06:11

Concerns addressed

@shahar1
shahar1 merged commit 0378a72 into apache:main Jul 25, 2026
83 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants