-
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
CmdRunner bugfix #7200
CmdRunner bugfix #7200
Conversation
Co-authored-by: Felix Fontein <felix@fontein.de>
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.
Then you also need to adjust the changelog fragment ;-)
Co-authored-by: Felix Fontein <felix@fontein.de>
@felixfontein thanks once again for your sharp eyes :-) |
Backport to stable-6: 💚 backport PR created✅ Backport PR branch: Backported as #7227 🤖 @patchback |
* cmd_runner module utils: fix bug when passing absolute path not in standard search paths * improved tests * changed /usr/bin/echo to /bin/echo for the sake of alpine * fixed error messaging for last testcase * add condition to test cases, and remove macos from troubling ones * fix templating * fix templating * exclude centos 6 from testcases copying echo to tmp dir * try different way of specifying version * trying trick for old jinjas * use os.path.isabs() to determine if path is absolute * add changelog frag * Update plugins/module_utils/cmd_runner.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update changelogs/fragments/7200-cmd-runner-abs-path.yml Co-authored-by: Felix Fontein <felix@fontein.de> --------- Co-authored-by: Felix Fontein <felix@fontein.de> (cherry picked from commit 8fa667e)
Backport to stable-7: 💚 backport PR created✅ Backport PR branch: Backported as #7228 🤖 @patchback |
* cmd_runner module utils: fix bug when passing absolute path not in standard search paths * improved tests * changed /usr/bin/echo to /bin/echo for the sake of alpine * fixed error messaging for last testcase * add condition to test cases, and remove macos from troubling ones * fix templating * fix templating * exclude centos 6 from testcases copying echo to tmp dir * try different way of specifying version * trying trick for old jinjas * use os.path.isabs() to determine if path is absolute * add changelog frag * Update plugins/module_utils/cmd_runner.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update changelogs/fragments/7200-cmd-runner-abs-path.yml Co-authored-by: Felix Fontein <felix@fontein.de> --------- Co-authored-by: Felix Fontein <felix@fontein.de> (cherry picked from commit 8fa667e)
@russoz thanks for fixing this! |
CmdRunner bugfix (#7200) * cmd_runner module utils: fix bug when passing absolute path not in standard search paths * improved tests * changed /usr/bin/echo to /bin/echo for the sake of alpine * fixed error messaging for last testcase * add condition to test cases, and remove macos from troubling ones * fix templating * fix templating * exclude centos 6 from testcases copying echo to tmp dir * try different way of specifying version * trying trick for old jinjas * use os.path.isabs() to determine if path is absolute * add changelog frag * Update plugins/module_utils/cmd_runner.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update changelogs/fragments/7200-cmd-runner-abs-path.yml Co-authored-by: Felix Fontein <felix@fontein.de> --------- Co-authored-by: Felix Fontein <felix@fontein.de> (cherry picked from commit 8fa667e) Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
CmdRunner bugfix (#7200) * cmd_runner module utils: fix bug when passing absolute path not in standard search paths * improved tests * changed /usr/bin/echo to /bin/echo for the sake of alpine * fixed error messaging for last testcase * add condition to test cases, and remove macos from troubling ones * fix templating * fix templating * exclude centos 6 from testcases copying echo to tmp dir * try different way of specifying version * trying trick for old jinjas * use os.path.isabs() to determine if path is absolute * add changelog frag * Update plugins/module_utils/cmd_runner.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update changelogs/fragments/7200-cmd-runner-abs-path.yml Co-authored-by: Felix Fontein <felix@fontein.de> --------- Co-authored-by: Felix Fontein <felix@fontein.de> (cherry picked from commit 8fa667e) Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
* cmd_runner module utils: fix bug when passing absolute path not in standard search paths * improved tests * changed /usr/bin/echo to /bin/echo for the sake of alpine * fixed error messaging for last testcase * add condition to test cases, and remove macos from troubling ones * fix templating * fix templating * exclude centos 6 from testcases copying echo to tmp dir * try different way of specifying version * trying trick for old jinjas * use os.path.isabs() to determine if path is absolute * add changelog frag * Update plugins/module_utils/cmd_runner.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update changelogs/fragments/7200-cmd-runner-abs-path.yml Co-authored-by: Felix Fontein <felix@fontein.de> --------- Co-authored-by: Felix Fontein <felix@fontein.de>
SUMMARY
CmdRunner
relies onAnsibleModule.get_bin_path()
to obtain the full path of the command going to be executed. That method uses thePATH
environment variable plus a hard-coded list of default paths. If a command is passed with an absolute path, specially if the path is not in the list of paths known byget_bin_path()
, it raises an error and it shouldn't.ISSUE TYPE
COMPONENT NAME
plugins/module_utils/cmd_runner.py
tests/integration/targets/cmd_runner/library/cmd_echo.py
tests/integration/targets/cmd_runner/meta/main.yml
tests/integration/targets/cmd_runner/tasks/test_cmd_echo.yml
tests/integration/targets/cmd_runner/vars/main.yml