
    Vh                    8    d dl mZ d dlZd dlmZ d dlmZ ddZy)    )annotationsN)is_executable)	deprecatec                   |t        ddd       g }g d}|g n|}|D ]6  }|t        j                  j                  |      s&|j	                  |       8 |t        j
                  j                  dd      j                  t        j                        z  }|D ]8  }||vst        j                  j                  |      s(|j	                  |       : d}|D ]t  }|st        j                  j                  ||       }t        j                  j                  |      sFt        j                  j                  |      rft        |      sr|} n |.t        d	| d
t        j                  j                  |            |S )a  
    Find system executable in PATH. Raises ValueError if the executable is not found.

    :param arg: the executable to find
    :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)
    :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.
    Nz=The `required` parameter in `get_bin_path` API is deprecated.z2.21zansible.builtin)msgversioncollection_name)z/sbinz	/usr/sbinz/usr/local/sbinPATH z$Failed to find required executable "z" in paths: )r   ospathexistsappendenvirongetsplitpathsepjoinisdirr   
ValueError)	argopt_dirsrequiredpaths
sbin_pathsdpbin_pathr   s	            S/home/dcms/DCMS/lib/python3.12/site-packages/ansible/module_utils/common/process.pyget_bin_pathr       sN     O-	
 E:J%r8H  =RWW^^A.LLO 
RZZ^^FB'--bjj99E  E>bggnnQ/LLO
 H ww||As#77>>$d(;d@SH SVXZXbXbXgXghmXnoppO    )NN)
__future__r   r    ansible.module_utils.common.filer   $ansible.module_utils.common.warningsr   r     r!   r   <module>r&      s    # 	 : :6r!   