diff --git a/changelogs/fragments/clarify_missing_exe.yml b/changelogs/fragments/clarify_missing_exe.yml new file mode 100644 index 00000000000..a087f561b71 --- /dev/null +++ b/changelogs/fragments/clarify_missing_exe.yml @@ -0,0 +1,2 @@ +bugfixes: + - get_bin_path, clarify with quotes what the missing required executable is. diff --git a/lib/ansible/module_utils/common/process.py b/lib/ansible/module_utils/common/process.py index 91e818a023f..f128cd98006 100644 --- a/lib/ansible/module_utils/common/process.py +++ b/lib/ansible/module_utils/common/process.py @@ -39,6 +39,6 @@ def get_bin_path(arg, opt_dirs=None, required=None): bin_path = path break if bin_path is None: - raise ValueError('Failed to find required executable %s in paths: %s' % (arg, os.pathsep.join(paths))) + raise ValueError('Failed to find required executable "%s" in paths: %s' % (arg, os.pathsep.join(paths))) return bin_path diff --git a/test/units/module_utils/common/process/test_get_bin_path.py b/test/units/module_utils/common/process/test_get_bin_path.py index a337e78d5e5..7c0bd0a8db5 100644 --- a/test/units/module_utils/common/process/test_get_bin_path.py +++ b/test/units/module_utils/common/process/test_get_bin_path.py @@ -35,5 +35,5 @@ def test_get_path_path_raise_valueerror(mocker): mocker.patch('os.path.isdir', return_value=False) mocker.patch('ansible.module_utils.common.process.is_executable', return_value=True) - with pytest.raises(ValueError, match='Failed to find required executable notacommand'): + with pytest.raises(ValueError, match='Failed to find required executable "notacommand"'): get_bin_path('notacommand')