관리-도구
편집 파일: process.cpython-39.opt-1.pyc
a �)gN � @ s: d dl mZmZmZ eZd dlZd dlmZ ddd�Z dS )� )�absolute_import�division�print_functionN)� is_executablec C s� |du rg n|}g d�}g }|D ]"}|dur t j�|�r |�|� q |t j�dd��t j�7 }d}|D ]"}||vrft j�|�rf|�|� qf|D ]@}|s�q�t j�|| �}t j�|�r�t j� |�s�t |�r�|} q�q�|du r�td| t j�|�f ��|S )a� Find system executable in PATH. Raises ValueError if executable is not found. Optional arguments: - required: [Deprecated] Prior to 2.10, if executable is not found and required is true it raises an Exception. In 2.10 and later, an Exception is always raised. This parameter will be removed in 2.14. - opt_dirs: optional list of directories to search in addition to PATH 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 found return full path, otherwise raise ValueError. N)z/sbinz /usr/sbinz/usr/local/sbin�PATH� z4Failed to find required executable "%s" in paths: %s)�os�path�exists�append�environ�get�split�pathsep�join�isdirr � ValueError) �argZopt_dirs�requiredZ sbin_paths�paths�dZbin_path�pr � r �G/usr/lib/python3.9/site-packages/ansible/module_utils/common/process.py�get_bin_path s* r )NN) Z __future__r r r �typeZ __metaclass__r Z ansible.module_utils.common.filer r r r r r �<module> s