관리-도구
편집 파일: file.cpython-39.opt-1.pyc
a �����)g�����������������������@���sn��d�dl�mZmZmZ�eZd�dlZd�dlZd�dlZd�dl Z d�dl Z d�dlZd�dlZd�dl Z d�dlZd�dlZd�dlZd�dlmZ�d�dlmZmZmZ�d�dlmZmZ�d�dlmZ�zd�dlZdZW�n�ey����dZY�n0�d d ddd dddddddddddddddd�Ze � d�Z!e � d�Z"e � d �Z#d!Z$d"Z%d#Z&d$d%��Z'd&d'��Z(d(d)��Z)d*d+��Z*G�d,d-��d-e+�Z,G�d.d/��d/�Z-dS�)0�����)�absolute_import�division�print_functionN)�contextmanager)�to_bytes� to_native�to_text)�b�binary_type)� deprecateTFZnoatime�append� compressedZnocowZnodumpZdirsyncZextentsZ encrypted� blocksizeZ immutableZindexedZ journalledZinlineZzeroZsynchronousZnotailZ blockrootZundeleteZ compressedrawZcompresseddirty)�A�a�c�C�d�D�e�E�h�i�I�j�N�s�S�t�T�u�X�Zz[+=-]z[^ugo]z[^rwxXstugo]i����I���i���c�����������������C���s"���t�jt�jB�t�jB�t��|��t�j�@�S�)a>��is_executable(path) is the given path executable? :arg path: The path of the file to check. Limitations: * Does not account for FSACLs. * Most times we really want to know "Can the current user execute this file". This function does not tell us that, only if any execute bit is set. )�stat�S_IXUSR�S_IXGRP�S_IXOTH�os�ST_MODE)�path��r+����D/usr/lib/python3.9/site-packages/ansible/module_utils/common/file.py� is_executableB���s����r-���c�����������������C���s���dd��|�D��}|S�)Nc�����������������S���s���g�|�]}|t�v�rt��|��qS�r+���)�FILE_ATTRIBUTES�get)�.0�attrr+���r+���r,���� <listcomp>[��������z%format_attributes.<locals>.<listcomp>r+���)� attributesZattribute_listr+���r+���r,����format_attributesZ���s����r5���c��������������������s �����fdd�t����D��}d�|�S�)Nc��������������������s���g�|�]\}}|��v�r|�qS�r+���r+���)r0����keyr1����r4���r+���r,���r2���`���r3���z-get_flags_from_attributes.<locals>.<listcomp>��)r.����items�join)r4����flagsr+���r7���r,����get_flags_from_attributes_���s����r<���c������������������C���s6���t�t�dd�t���t���t���t���t���t���t�dgd�d�}�|�S�)N�raw)�typer1���)�aliases)�mode�owner�groupZseuserZseroleZselevelZsetyper4���)�dict)Zarg_specr+���r+���r,����get_file_arg_specd���s���� � rD���c�������������������@���s���e�Zd�ZdS�)�LockTimeoutN)�__name__� __module__�__qualname__r+���r+���r+���r,���rE���r���s���rE���c�������������������@���s8���e�Zd�ZdZdd��Zeddd��Zddd�Zd d ��ZdS�) �FileLocka�� Currently FileLock is implemented via fcntl.flock on a lock file, however this behaviour may change in the future. Avoid mixing lock types fcntl.flock, fcntl.lockf and module_utils.common.file.FileLock as it will certainly cause unwanted and/or unexpected behaviour c�����������������C���s���t�ddd��d�|�_d�S�)Nz�FileLock is not reliable and has never been used in core for that reason. There is no current alternative that works across POSIX targetsz2.16)�version)r����lockfd��selfr+���r+���r,����__init__}���s�����zFileLock.__init__Nc�����������������c���s0���z |���|||��dV��W�|�����n |�����0�dS�)z. Context for lock acquisition N)�set_lock�unlock)rM���r*����tmpdir�lock_timeoutr+���r+���r,���� lock_file����s����zFileLock.lock_filec�����������������C���s&��t�j�|d�t�j�|���}d}t}tjd�dkr6t}t |d�|�_ |dkrxt�|�j tj tjB���t��|tjtjB���dS�|��r�d}||k�r�z0t�|�j tj tjB���t��|tjtjB���W�dS��|y����t�|��||7�}Y�q�Y�q�0�q�|�j ����td�|���t�|�j tj ��t��|tjtjB���dS�)ak�� Create a lock file based on path with flock to prevent other processes using given path. Please note that currently file locking only works when it's executed by the same user, I.E single user scenarios :kw path: Path (file) to lock :kw tmpdir: Path where to place the temporary .lock file :kw lock_timeout: Wait n seconds for lock acquisition, fail if timeout is reached. 0 = Do not wait, fail if lock cannot be acquired immediately, Default is None, wait indefinitely until lock is released. :returns: True zansible-{0}.lockg�������?r��������wTz{0} sec)r(���r*���r:����format�basename�IOError�sys�version_info�BlockingIOError�openrK����fcntl�flockZLOCK_EXZLOCK_NB�chmodr$����S_IWRITE�S_IREAD�time�sleep�closerE���)rM���r*���rQ���rR���Z lock_pathZl_waitZr_exceptionZe_secsr+���r+���r,���rO�������s4���� zFileLock.set_lockc�����������������C���s@���|�j�s dS�zt�|�j�tj��|�j�����W�n�ty:���Y�n0�dS�)z� Make sure lock file is available for everyone and Unlock the file descriptor locked by set_lock :returns: True T)rK���r]���r^���ZLOCK_UNrd���� ValueErrorrL���r+���r+���r,���rP�������s����zFileLock.unlock)N)N) rF���rG���rH����__doc__rN���r���rS���rO���rP���r+���r+���r+���r,���rI���v���s��� 0rI���).Z __future__r���r���r���r>���Z __metaclass__�errnor(���r$����re�pwd�grprb����shutil� tracebackr]���rY���� contextlibr���Zansible.module_utils._textr���r���r���Zansible.module_utils.sixr ���r ���Z$ansible.module_utils.common.warningsr���ZselinuxZHAVE_SELINUX�ImportErrorr.����compileZMODE_OPERATOR_REZUSERS_REZPERMS_REZ _PERM_BITSZ_EXEC_PERM_BITSZ _DEFAULT_PERMr-���r5���r<���rD���� ExceptionrE���rI���r+���r+���r+���r,����<module>���sl��� �