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

Add support for extra parameters to samba client #16115

Merged
merged 8 commits into from
Jun 6, 2021

Conversation

malthe
Copy link
Contributor

@malthe malthe commented May 27, 2021

This adds the option to use the extra field for adding additional parameters to the SambaClient constructor such as workgroup using JSON-formatting.

Read the Pull Request Guidelines for more information.
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.

samba = SambaClient(
server=self.conn.host,
share=self.conn.schema,
username=self.conn.login,
ip=self.conn.host,
password=self.conn.password,
**self.conn.extra_dejson,
Copy link
Member

Choose a reason for hiding this comment

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

Is the list of fields exhaustive? I feel we should do some sanitising instead of passing the whole JSON object directly in.

Also :param is for function arguments and should not be used for extra keys. These descriptions should live somewhere else.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@uranusjr fixed in 0c8cca7 – the list is inexhaustive (mentioned now) and I have reformatted as definition list.

The :param stuff was token from the Oracle hook, but I guess that is a bad example :-)

By the way, I have since realized that the underlying Python library that supports SambaHook is basically abandonware and not particularly useful – it breaks quite a few expectations if you look at the actual smbclient functionality.

Copy link
Member

Choose a reason for hiding this comment

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

By the way, I have since realized that the underlying Python library that supports SambaHook is basically abandonware and not particularly useful

Thanks for taising this. It would be worthwhile to open an issue for this to migrate to another library, I think. I don’t have much experience dealing with SMB with Python, but pysmb seems to be a popular choice.

Copy link
Contributor

Choose a reason for hiding this comment

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

There is an open issue: #14054

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@uranusjr so I think we can perhaps go ahead and consider merging this request and then I'll submit another request to migrate to pysmb.

I have already done some testing and it seems very well suited.

Copy link
Member

Choose a reason for hiding this comment

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

Yup LGTM. Could you close-reopen the PR to trigger CI?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@uranusjr done

Copy link
Contributor

@eladkal eladkal Jun 3, 2021

Choose a reason for hiding this comment

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

@malthe
Can you please rebase to latest main (former master branch)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@eladkal done!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@eladkal looks about ready now, checks have run.

@malthe malthe closed this Jun 1, 2021
@malthe malthe reopened this Jun 1, 2021
@eladkal eladkal self-requested a review June 3, 2021 06:41
@malthe malthe force-pushed the add-extra-json-to-samba-hook branch from 0c8cca7 to b41b0be Compare June 3, 2021 06:44
Copy link
Contributor

@eladkal eladkal left a comment

Choose a reason for hiding this comment

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

LGTM
will merge when CI is green

@github-actions
Copy link

github-actions bot commented Jun 3, 2021

The PR is likely OK to be merged with just subset of tests for default Python and Database versions without running the full matrix of tests, because it does not modify the core of Airflow. If the committers decide that the full tests matrix is needed, they will add the label 'full tests needed'. Then you should rebase to the latest main or amend the last commit of the PR, and push it with --force-with-lease.

@github-actions github-actions bot added the okay to merge It's ok to merge this PR as it does not require more tests label Jun 3, 2021
@eladkal
Copy link
Contributor

eladkal commented Jun 4, 2021

@malthe can you fix the static test?

@malthe
Copy link
Contributor Author

malthe commented Jun 4, 2021

@eladkal fixed – I don't really understand this automated build, but the static test seems to be skipped now.

@malthe malthe force-pushed the add-extra-json-to-samba-hook branch from 0f6217a to b1b0297 Compare June 4, 2021 09:17
@@ -128,7 +128,7 @@ def test_wait_for_job_cancelled(self, mock_get_job):

@requests_mock.mock()
def test_connection_success(self, m):
m.get(self.health_endpoint, status_code=200,)
m.get(self.health_endpoint, status_code=200)
Copy link
Contributor

Choose a reason for hiding this comment

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

This change is not related :)
We also had a broken CI so another rebase so fix the failing tests

@malthe malthe force-pushed the add-extra-json-to-samba-hook branch from eb193b8 to 88c2079 Compare June 4, 2021 19:45
@malthe
Copy link
Contributor Author

malthe commented Jun 5, 2021

@eladkal should be ready now.

@malthe malthe force-pushed the add-extra-json-to-samba-hook branch from 88c2079 to ea4e6aa Compare June 6, 2021 08:02
@eladkal eladkal merged commit a47a254 into apache:main Jun 6, 2021
@malthe malthe deleted the add-extra-json-to-samba-hook branch June 7, 2021 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:providers okay to merge It's ok to merge this PR as it does not require more tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants