From 29145b15de3701a04a78e642ae83c0e735dde19c Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Thu, 30 Jun 2022 07:18:38 +0200 Subject: [PATCH] Fix command variable usage in CmdRunner (#4903) (#4905) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix command variable usage * Add changelog fragment for cmd-runner bugfix (#4903) (cherry picked from commit 265c052c27f5d3d1b2fc80a771172f32140d0140) Co-authored-by: Álvaro García Jaén --- changelogs/fragments/4903-cmdrunner-bugfix.yaml | 2 ++ plugins/module_utils/cmd_runner.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/4903-cmdrunner-bugfix.yaml diff --git a/changelogs/fragments/4903-cmdrunner-bugfix.yaml b/changelogs/fragments/4903-cmdrunner-bugfix.yaml new file mode 100644 index 00000000000..6ed2ec9fa27 --- /dev/null +++ b/changelogs/fragments/4903-cmdrunner-bugfix.yaml @@ -0,0 +1,2 @@ +bugfixes: + - cmd_runner module utils - fix bug caused by using the ``command`` variable instead of ``self.command`` when looking for binary path (https://github.com/ansible-collections/community.general/pull/4903). diff --git a/plugins/module_utils/cmd_runner.py b/plugins/module_utils/cmd_runner.py index 8048ed25ca7..f7b52d22ffc 100644 --- a/plugins/module_utils/cmd_runner.py +++ b/plugins/module_utils/cmd_runner.py @@ -191,7 +191,7 @@ def __init__(self, module, command, arg_formats=None, default_args_order=(), environ_update = {} self.environ_update = environ_update - self.command[0] = module.get_bin_path(command[0], opt_dirs=path_prefix, required=True) + self.command[0] = module.get_bin_path(self.command[0], opt_dirs=path_prefix, required=True) for mod_param_name, spec in iteritems(module.argument_spec): if mod_param_name not in self.arg_formats: