Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Depreciate private_key_pass extra param and rename to private_key_passphrase #14028

Merged
merged 1 commit into from
Jun 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions airflow/providers/sftp/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ Changelog
1.1.1
.....

Features
~~~~~~~~

* ``SFTPHook private_key_pass extra param is deprecated and renamed to private_key_passphrase, for consistency with
arguments' naming in SSHHook``

Bug fixes
~~~~~~~~~

Expand Down
15 changes: 13 additions & 2 deletions airflow/providers/sftp/hooks/sftp.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,24 @@ def __init__(self, ftp_conn_id: str = 'sftp_default', *args, **kwargs) -> None:
conn = self.get_connection(self.ssh_conn_id)
if conn.extra is not None:
extra_options = conn.extra_dejson
if 'private_key_pass' in extra_options:
self.private_key_pass = extra_options.get('private_key_pass')
Comment on lines -79 to -80
Copy link
Member

Choose a reason for hiding this comment

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

This makes this PR a breaking change -- could you please add a back-compatiblity path in (i.e. something that notices when this option is set but the new one is not, uses it and issues a deprecation warning)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

✔️ Done


# For backward compatibility
# TODO: remove in Airflow 2.1
import warnings

if 'private_key_pass' in extra_options:
warnings.warn(
'Extra option `private_key_pass` is deprecated.'
'Please use `private_key_passphrase` instead.'
'`private_key_passphrase` will precede if both options are specified.'
'The old option `private_key_pass` will be removed in Airflow 2.1',
DeprecationWarning,
stacklevel=2,
)
self.private_key_pass = extra_options.get(
'private_key_passphrase', extra_options.get('private_key_pass')
)

if 'ignore_hostkey_verification' in extra_options:
warnings.warn(
'Extra option `ignore_hostkey_verification` is deprecated.'
Expand Down