diff --git a/changelogs/fragments/required_get_bin_path.yml b/changelogs/fragments/required_get_bin_path.yml new file mode 100644 index 00000000000..8fc7a5d5a14 --- /dev/null +++ b/changelogs/fragments/required_get_bin_path.yml @@ -0,0 +1,3 @@ +--- +removed_features: + - Removed 'required' option from get_bin_path API (https://github.com/ansible/ansible/issues/85998). diff --git a/lib/ansible/module_utils/common/process.py b/lib/ansible/module_utils/common/process.py index 5c546ec6c43..a2ae0112bcd 100644 --- a/lib/ansible/module_utils/common/process.py +++ b/lib/ansible/module_utils/common/process.py @@ -6,10 +6,9 @@ from __future__ import annotations import os from ansible.module_utils.common.file import is_executable -from ansible.module_utils.common.warnings import deprecate -def get_bin_path(arg, opt_dirs=None, required=None): +def get_bin_path(arg, opt_dirs=None): """ Find system executable in PATH. Raises ValueError if the executable is not found. @@ -17,20 +16,12 @@ def get_bin_path(arg, opt_dirs=None, required=None): :type arg: string :param opt_dirs: optional list of directories to search in addition to PATH :type opt_dirs: list of strings - :param required: DEPRECATED. This parameter will be removed in 2.21 - :type required: boolean - :returns: path to arg (should be abs path unless PATH or opt_dirs are relative paths) + :returns: path to arg (should be absolute path unless PATH or opt_dirs are relative paths) :raises: ValueError: if arg is not found In addition to PATH and opt_dirs, this function also looks through /sbin, /usr/sbin and /usr/local/sbin. A lot of modules, especially for gathering facts, depend on this behaviour. """ - if required is not None: - deprecate( - msg="The `required` parameter in `get_bin_path` API is deprecated.", - version="2.21", - ) - paths = [] sbin_paths = ['/sbin', '/usr/sbin', '/usr/local/sbin'] opt_dirs = [] if opt_dirs is None else opt_dirs diff --git a/test/sanity/ignore.txt b/test/sanity/ignore.txt index 197b3314748..e9a53020272 100644 --- a/test/sanity/ignore.txt +++ b/test/sanity/ignore.txt @@ -235,7 +235,6 @@ test/integration/targets/ansible-test-sanity-pylint/deprecated_thing.py pylint:a test/integration/targets/ansible-test-sanity-pylint/deprecated_thing.py pylint:ansible-deprecated-collection-name-not-permitted # required to verify plugin against core lib/ansible/module_utils/basic.py pylint:ansible-deprecated-version # TODO: 2.21 lib/ansible/module_utils/basic.py pylint:ansible-deprecated-version-comment # TODO: 2.21 -lib/ansible/module_utils/common/process.py pylint:ansible-deprecated-version # TODO: 2.21 lib/ansible/module_utils/common/validation.py pylint:ansible-deprecated-version # TODO: 2.21 lib/ansible/module_utils/compat/datetime.py pylint:ansible-deprecated-version # TODO: 2.21 lib/ansible/module_utils/compat/paramiko.py pylint:ansible-deprecated-version # TODO: 2.21