-
Notifications
You must be signed in to change notification settings - Fork 13.7k
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 option to add arguments to PSRP hook and operator #27689
Conversation
5583191
to
fda3956
Compare
warn( | ||
"Passing **kwargs to 'invoke_cmdlet' is deprecated " | ||
"and will be removed in a future release. Please use 'parameters' " | ||
"instead.", | ||
DeprecationWarning, | ||
stacklevel=2, | ||
) |
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.
I wonder if it is worthwhile to do this rather than just bump the major version and break compatibility.
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.
I guess it's nice enough to have a deprecation; doesn't cost much.
ab525c2
to
4cf3d10
Compare
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. |
This also adds 'parameters' as an optional keyword argument to 'invoke_cmdlet', preferred over passing **kwargs (now deprecated). The change to 'parameters' is motivated by the fact that most parameters to cmdlets in Windows are capitalized, which is at odds with the common Python parameter style.
Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
6906164
to
ee84ad3
Compare
@uranusjr should we consider merging this one? I rebased it. |
:param arguments: | ||
When using the `cmdlet` or `powershell` option, use `arguments` to | ||
provide arguments (templated). | ||
:param parameters: | ||
When using the `cmdlet` or `powershell` arguments, use this parameter to | ||
When using the `cmdlet` or `powershell` option, use `parameters` to | ||
provide parameters (templated). Note that a parameter with a value of `None` | ||
becomes an *argument* (i.e., switch). |
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.
I’m assuming users fluent with Powershell would understand the difference between these? I wonder if we should add a link to some documentation about this.
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.
There's a link in the provider documentation to https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-psrp/.
Most Windows superusers will be familiar with the Invoke-Command cmdlet which has the same interface.
This adds an optional
arguments
parameter to the hook and operator which allows invoking cmdlets with arguments (rather than parameters, i.e. named arguments).At the same time, passing parameters to
invoke_cmdlet
using **kwargs notation is deprecated; instead, parameters are now passed using theparameters
optional keyword arguments.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.rst
or{issue_number}.significant.rst
, in newsfragments.