From 4b4a4e5e5d690d8985e9eec0cd0826411e60cfa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Garc=C3=ADa=20Ja=C3=A9n?= Date: Thu, 30 Jun 2022 07:08:55 +0200 Subject: [PATCH] Fix command variable usage in CmdRunner (#4903) * Fix command variable usage * Add changelog fragment for cmd-runner bugfix (#4903) --- 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 6aec7b1a90b..70187e68ed8 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: