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

Fix command variable usage in CmdRunner #4903

Merged
merged 2 commits into from
Jun 30, 2022

Conversation

alvarontwrk
Copy link
Contributor

SUMMARY

It exists a bug in CmdRunner where the wrong "command" variable is being used in order to get the binary path.

Before executing, it is ensured that the command is a list.

self.command = _ensure_list(command)

However, further in the code, command[0] is used instead of self.command[0].

self.command[0] = module.get_bin_path(command[0], opt_dirs=path_prefix, required=True)

Because of this, if command is a string (p.e. xfconf-query), get_bin_path will look for "x" instead of "xfconf-query".

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

plugins/module_utils/cmd_runner.py

ADDITIONAL INFORMATION

Right now, this is affecting the following components:

  • plugins/module_utils/xfconf.py
  • plugins/module_utils/gconftool2.py

@ansibullbot ansibullbot added bug This issue/PR relates to a bug module_utils module_utils new_contributor Help guide this first time contributor plugins plugin (any type) small_patch Hopefully easy to review labels Jun 28, 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.

Thanks for your contribution! Could you please add a changelog fragment? Thanks.

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

@felixfontein done!

@ansibullbot ansibullbot removed the small_patch Hopefully easy to review label Jun 29, 2022
@felixfontein
Copy link
Collaborator

CC @russoz

Copy link
Collaborator

@russoz russoz left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for catching it up!

@felixfontein felixfontein merged commit 265c052 into ansible-collections:main Jun 30, 2022
@patchback
Copy link

patchback bot commented Jun 30, 2022

Backport to stable-4: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-4/265c052c27f5d3d1b2fc80a771172f32140d0140/pr-4903

Backported as #4905

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

@felixfontein
Copy link
Collaborator

@alvarontwrk thanks for fixing this!
@russoz thanks for reviewing!

patchback bot pushed a commit that referenced this pull request Jun 30, 2022
* Fix command variable usage

* Add changelog fragment for cmd-runner bugfix (#4903)

(cherry picked from commit 265c052)
@patchback
Copy link

patchback bot commented Jun 30, 2022

Backport to stable-5: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-5/265c052c27f5d3d1b2fc80a771172f32140d0140/pr-4903

Backported as #4906

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

@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label Jun 30, 2022
patchback bot pushed a commit that referenced this pull request Jun 30, 2022
* Fix command variable usage

* Add changelog fragment for cmd-runner bugfix (#4903)

(cherry picked from commit 265c052)
felixfontein pushed a commit that referenced this pull request Jun 30, 2022
* Fix command variable usage

* Add changelog fragment for cmd-runner bugfix (#4903)

(cherry picked from commit 265c052)

Co-authored-by: Álvaro García Jaén <[email protected]>
felixfontein pushed a commit that referenced this pull request Jun 30, 2022
* Fix command variable usage

* Add changelog fragment for cmd-runner bugfix (#4903)

(cherry picked from commit 265c052)

Co-authored-by: Álvaro García Jaén <[email protected]>
bratwurzt pushed a commit to bratwurzt/community.general that referenced this pull request Nov 7, 2022
* Fix command variable usage

* Add changelog fragment for cmd-runner bugfix (ansible-collections#4903)
bratwurzt pushed a commit to bratwurzt/community.general that referenced this pull request Nov 7, 2022
* Fix command variable usage

* Add changelog fragment for cmd-runner bugfix (ansible-collections#4903)
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
bug This issue/PR relates to a bug module_utils module_utils new_contributor Help guide this first time contributor plugins plugin (any type)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants