Removed parameter 'required' from get_bin_path API (#86009)

Fixes: #85998

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
pull/85939/head
Abhijeet Kasurde 1 month ago committed by GitHub
parent 790b66f383
commit 9f1177a056
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,3 @@
---
removed_features:
- Removed 'required' option from get_bin_path API (https://github.com/ansible/ansible/issues/85998).

@ -6,10 +6,9 @@ from __future__ import annotations
import os import os
from ansible.module_utils.common.file import is_executable 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. 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 :type arg: string
:param opt_dirs: optional list of directories to search in addition to PATH :param opt_dirs: optional list of directories to search in addition to PATH
:type opt_dirs: list of strings :type opt_dirs: list of strings
:param required: DEPRECATED. This parameter will be removed in 2.21 :returns: path to arg (should be absolute path unless PATH or opt_dirs are relative paths)
:type required: boolean
:returns: path to arg (should be abs path unless PATH or opt_dirs are relative paths)
:raises: ValueError: if arg is not found :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 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. 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 = [] paths = []
sbin_paths = ['/sbin', '/usr/sbin', '/usr/local/sbin'] sbin_paths = ['/sbin', '/usr/sbin', '/usr/local/sbin']
opt_dirs = [] if opt_dirs is None else opt_dirs opt_dirs = [] if opt_dirs is None else opt_dirs

@ -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 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 # TODO: 2.21
lib/ansible/module_utils/basic.py pylint:ansible-deprecated-version-comment # 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/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/datetime.py pylint:ansible-deprecated-version # TODO: 2.21
lib/ansible/module_utils/compat/paramiko.py pylint:ansible-deprecated-version # TODO: 2.21 lib/ansible/module_utils/compat/paramiko.py pylint:ansible-deprecated-version # TODO: 2.21

Loading…
Cancel
Save