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

cmd_runner: add __call__ method to invoke context #4791

Merged

Conversation

russoz
Copy link
Collaborator

@russoz russoz commented Jun 6, 2022

SUMMARY

Method context() renamed to __call__(), but retaining an alias from the old name to the new one, for compatibility.
That change will allow a more concise idiom when running the commands.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

plugins/module_utils/cmd_runner.py

@ansibullbot ansibullbot added feature This issue/PR relates to a feature request module_utils module_utils plugins plugin (any type) tests tests unit tests/unit labels Jun 6, 2022
Copy link
Collaborator

@felixfontein felixfontein left a comment

Choose a reason for hiding this comment

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

Maybe add some actual code changes that use context() to this PR. (Also don't forget the changelog fragment :) )

@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-5 labels Jun 6, 2022
@russoz
Copy link
Collaborator Author

russoz commented Jun 8, 2022

@felixfontein do you mean that uses __call__? The existing code that uses cmd_runner were written when context.

@russoz
Copy link
Collaborator Author

russoz commented Jun 8, 2022

And I have unit tests for both usages.

@felixfontein
Copy link
Collaborator

I mean changing some of the existing code that uses context() so that it uses __call__(), yes.

@russoz
Copy link
Collaborator Author

russoz commented Jun 9, 2022

I mean changing some of the existing code that uses context() so that it uses __call__(), yes.

That will prove that Python works as expected. :-P

Anyways, done.

@ansibullbot
Copy link
Collaborator

Co-authored-by: Felix Fontein <felix@fontein.de>
@felixfontein felixfontein merged commit 739ca73 into ansible-collections:main Jun 15, 2022
@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label Jun 15, 2022
@patchback
Copy link

patchback bot commented Jun 15, 2022

Backport to stable-5: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-5/739ca737f1bce3d6e8dd2caa1cd6749faa4e2106/pr-4791

Backported as #4844

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@felixfontein
Copy link
Collaborator

@russoz thanks for this improvement!

patchback bot pushed a commit that referenced this pull request Jun 15, 2022
* cmd_runner: add __call__ method to invoke context

* change xfconf to use the callable form

* add changelog fragment

* Update changelogs/fragments/4791-cmd-runner-callable.yaml

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 739ca73)
@russoz russoz deleted the cmd_runner_callable branch June 15, 2022 06:08
felixfontein pushed a commit that referenced this pull request Jun 15, 2022
* cmd_runner: add __call__ method to invoke context

* change xfconf to use the callable form

* add changelog fragment

* Update changelogs/fragments/4791-cmd-runner-callable.yaml

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 739ca73)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This was referenced Nov 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This issue/PR relates to a feature request module_utils module_utils module module plugins plugin (any type) system tests tests unit tests/unit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants