%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3.9/site-packages/ansible/module_utils/facts/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3.9/site-packages/ansible/module_utils/facts/__pycache__/utils.cpython-39.pyc

a

�)g�
�@sHddlmZmZmZeZddlZddlZd
dd�Zddd�Z	dd	�Z
dS)�)�absolute_import�division�print_functionNTcCs�|}tj�|�r�t�|tj�r�d}z�ztt|�}z0|��}t�|tj�}t�|tj	|tj
B�WntypYn0|��}|r�|�
�}t|�dkr�|}Wnty�Yn0W|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_contents.

�
rcCsTt||d�}|rL|dur"|��}qPt|�dkr@|�|��|�}qP|�|�}ng}|S)zget list of lines from file)rN�)r�
splitlinesr�rstrip�split)rrZline_sepr�retrrr�get_file_linesAs
rcCs�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	<Wnty�Yn0|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_resultrrr�get_mount_sizeQs





r))NT)TN)Z
__future__rrr�typeZ
__metaclass__rrrrr)rrrr�<module>s
*


Zerion Mini Shell 1.0