@ -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