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

Switch to 'smbprotocol' library #17273

Merged
merged 7 commits into from
Aug 1, 2021
Merged

Conversation

malthe
Copy link
Contributor

@malthe malthe commented Jul 27, 2021

This change switches the Samba hook implementation to the smbprotocol library.

As discussed in #14054 the current implementation uses an unmaintained and outdated library.

In addition, the implementation suggested here conveniently exposes a large part of the user-friendly API provided by the underlying library. For example, to use the smbclient.getxattr function, one would call samba_hook.getxattr (with connection details being automatically provided).


closes: #14054

Copy link
Member

@uranusjr uranusjr left a comment

Choose a reason for hiding this comment

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

❤️

}

def __enter__(self):
# This immediately connects to the host (which can be
Copy link
Member

Choose a reason for hiding this comment

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

If I read that correctly - it means that SambaHook MUST be used as ContextManager in some cases, otherwise there might some problems with initializing some parameters during constructor? This is not a usual pattern we have in Airflow for hooks (though I think it's nice pattern for Hooks) but I think some explanation is needed at least in the docstring explaining the difference between the two and when to use it?

Also - would you mind to add a CHANGELOG.txt entry? Don't yet put the version (I will update it) but some backwards-compatibility notes are needed (how to migrate?)

Copy link
Contributor Author

@malthe malthe Jul 28, 2021

Choose a reason for hiding this comment

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

@potiuk where would those notes go? I don't see other changelog entries with such information. I have added a simple changelog entry for now and a note in the docstring about using it as a context manager.

Copy link
Member

Choose a reason for hiding this comment

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

You could see some of those in other providers - for example look at the Google provider: https://github.com/apache/airflow/blob/main/airflow/providers/google/CHANGELOG.rst - usually when there are braking changes that require more than one-line mentioning.

Even in Samba, we've added a warning when we removed "apply_default" (this was a global one and it actually did NOT really apply to samba but it went there as it was "all operator" change.

https://github.com/apache/airflow/blob/main/airflow/providers/samba/CHANGELOG.rst

@github-actions github-actions bot added the full tests needed We need to run full set of tests for this PR to merge label Jul 28, 2021
@github-actions
Copy link

The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease.

@malthe malthe force-pushed the issue-14054-smbprotocol branch 3 times, most recently from b7a927c to 8f75fbe Compare July 29, 2021 21:49
CHANGELOG.txt Outdated
Comment on lines 1 to 5
Improvements
""""""""""""

- The Samba hook now uses the `smbprotocol` library, exposing a much
bigger set of functionality and supporting SMB2/3 protocols.
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kaxil thanks – I have removed this entry again. I had actually already written a more detailed changelog entry in the provider changelog.

@malthe malthe closed this Aug 1, 2021
@malthe malthe reopened this Aug 1, 2021
@malthe
Copy link
Contributor Author

malthe commented Aug 1, 2021

@uranusjr this seems to fail for no apparant reason.

@potiuk
Copy link
Member

potiuk commented Aug 1, 2021

seems like the errors were rather unrelated "stability" problems. Merging.

@potiuk potiuk merged commit f53dace into apache:main Aug 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:providers full tests needed We need to run full set of tests for this PR to merge kind:documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SambaHook using old unmaintained library
4 participants