-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Add PSRP connection type #34766
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 PSRP connection type #34766
Conversation
hussein-awala
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some tips for better contribution:
- Use a good/clear title for your PR
- Add a description for your change even if you add the related issue
- Keep your PR as draft while it is not ready
Are you sure that this correct issue? Issue related to apache-airflow-providers-microsoft-winrm but changes made in apache-airflow-providers-microsoft-psrp |
|
If this changes are correct, than I guess it more related to |
|
@hussein-awala I didn't even know you could do a draft, so thanks for pointing that out. My final version will have a better title, details, etc. @Taragolis It is kind-of related, I guess it can take down two stones at a time. |
|
@hussein-awala or @Taragolis do you see what I am doing wrong here? I added the connection-type in provider.yaml which appears to be where the provider info and conns are looked up from for the UI, but it does not show up. |
Problem with incorrect path to the PsrpHook, this could be found in case of running Static Code Checks Finished check: Found 0 errors in 1 checked items
Found 1 error in providers
Error: The `airflow.providers.microsoft.psrp.hooks.PsrpHook` object in connection-types list in airflow/providers/microsoft/psrp/provider.yaml does not exist or is not a class: module 'airflow.providers.microsoft.psrp.hooks' has no attribute 'PsrpHook'After changes it appear in to the Connection UI as well as by run Some other useful links for which might help you for contribution to Airflow |
Co-authored-by: Andrey Anshin <Andrey.Anshin@taragol.is>
Co-authored-by: Andrey Anshin <Andrey.Anshin@taragol.is>
|
@Taragolis Yikes, what a terrible oversight. I saw the static checks but did not check it properly enough. Thank you! |
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions. |
|
@arjunanan6 any progress on this – seems like you've found the issue and just need to rebase this? |
|
@malthe Haven't had any time of late, but let me see if I can finish it up this week. |
|
@Taragolis @malthe what do you think about the test I've just added? |
|
@arjunanan6 you don't need to actually invoke any command; instead, simply enter into the hook context: with PsrpHook(psrp_conn_id=self.conn_id):
passThis will raise an exception if there is a connection error. It works because entering the hook will in turn enter into the runspace pool context, which automatically connects it to the remote machine, establishing a connection. |
Ah interesting, so I overdid it then. I'll make a change shortly and push it. |
…fork into arjunanan6/psrp-conn
|
@arjunanan6 now, to test this, you would build on the existing suite: class TestPsrpHook:
....
def test_test_connection(self, runspace_pool, *mocks):
with PsrpHook(CONNECTION_ID):
# Assert that the `runspace_pool` has been entered into, i.e. opened.Something along the lines of assert runspace_pool.return_value.__enter__.mock_calls == [call()] |
|
@malthe Awesome, thanks for that! I'll get on it. |
|
I'm aware of the failing tests, I will look into it asap! |
|
@Taragolis Sorry about the extreme delay, I had some stuff going on. I think this is now ready for a review. Could you take a look when you have time? Thank you. |
malthe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me

This change intends on adding the PowerShell remoting protocol (PSRP) type connection along with a test function.
related: #19739
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an 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 a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in newsfragments.