-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Conversation
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.
Thanks for your contribution! Could you please add a changelog fragment? Thanks.
@felixfontein done! |
CC @russoz |
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.
LGTM, thanks for catching it up!
Backport to stable-4: 💚 backport PR created✅ Backport PR branch: Backported as #4905 🤖 @patchback |
@alvarontwrk thanks for fixing this! |
Backport to stable-5: 💚 backport PR created✅ Backport PR branch: Backported as #4906 🤖 @patchback |
* Fix command variable usage * Add changelog fragment for cmd-runner bugfix (ansible-collections#4903)
* Fix command variable usage * Add changelog fragment for cmd-runner bugfix (ansible-collections#4903)
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 ofself.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
COMPONENT NAME
plugins/module_utils/cmd_runner.py
ADDITIONAL INFORMATION
Right now, this is affecting the following components: