관리-도구
편집 파일: utils.cpython-39.opt-1.pyc
a �����)g� ����������������������@���sH���d�dl�mZmZmZ�eZd�dlZd�dlZd dd�Zddd�Z dd ��Z dS�)�����)�absolute_import�division�print_functionNTc�����������������C���s����|}t�j�|��r�t��|�t�j�r�d}z�ztt|��}z0|���}t�|tj�}t�|tj |t�j B���W�n�typ���Y�n0�|���}|r�|� ��}t|�dkr�|}W�n�ty����Y�n0�W�|dur�|����n|dur�|����0�|S�)aS�� Return the contents of a given file path :args path: path to file to return contents from :args default: value to return if we could not read file :args strip: controls if we strip whitespace from the result or not :returns: String with file contents (optionally stripped) or 'default' value Nr���)�os�path�exists�access�R_OK�open�fileno�fcntlZF_GETFLZF_SETFL� O_NONBLOCK� Exception�read�strip�len�close)r����defaultr����dataZdatafile�fd�flag��r����D/usr/lib/python3.9/site-packages/ansible/module_utils/facts/utils.py�get_file_content���s.���� � r���c�����������������C���sT���t�|�|d�}|rL|du�r"|���}qPt|�dkr@|�|��|�}qP|�|�}ng�}|S�)zget list of lines from file)r���N����)r���� splitlinesr����rstrip�split)r���r���Zline_sepr����retr���r���r����get_file_linesA���s���� r���c�����������������C���s����i�}z�t��|��}|j|j�|d<�|j|j�|d<�|j|d<�|j|d<�|j|d<�|d�|d��|d<�|j|d<�|j|d<�|d�|d��|d <�W�n�ty����Y�n0�|S�) NZ size_totalZsize_availableZ block_sizeZblock_totalZblock_availableZ block_usedZinode_totalZinode_availableZ inode_used) r����statvfs�f_frsize�f_blocks�f_bavail�f_bsize�f_files�f_favail�OSError)Z mountpointZ mount_size�statvfs_resultr���r���r����get_mount_sizeQ���s���� r)���)NT)TN)Z __future__r���r���r����typeZ __metaclass__r���r���r���r���r)���r���r���r���r����<module>���s��� *