HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.29
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/extfs.cpython-310.pyc
o

�N�g�"�@sXdZddlZddlZe�e�Zdd�Zdd�Zdd�Z	dd	d
�Z
ddd�Zdd
d�ZdS)z+
Module for managing ext2/3/4 file systems
�NcCstjj��rdSdS)z)
    Only work on POSIX-like systems
    )FzSThe extfs execution module cannot be loaded: only available on non-Windows systems.T)�salt�utils�platformZ
is_windows�rr�F/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/extfs.py�__virtual__src	Ksfidd�dd�dd�dd�d	d
�dd�d
d�dd�dd�dd�dd�dd�dd�dd�dd�dd �d!d"�d#d$d%d&d'd(d)d*��}d+}|D]&}||vri||}||d,kr\|d-|�d.�7}qC|d-|�d.||�d.�7}qCd/|�d.|�|��}td0|d1d2���}g}	|D].}
|
s�q�|
�d3�r�q�|
�d4�r�q�|
�d5�r�q�|
�d6�r�q�|
�d7�r�q�|
�d8�r�q�|	�|
�q�|	S)9a�
    Create a file system on the specified device

    CLI Example:

    .. code-block:: bash

        salt '*' extfs.mkfs /dev/sda1 fs_type=ext4 opts='acl,noexec'

    Valid options are:

    * **block_size**: 1024, 2048 or 4096
    * **check**: check for bad blocks
    * **direct**: use direct IO
    * **ext_opts**: extended file system options (comma-separated)
    * **fragment_size**: size of fragments
    * **force**: setting force to True will cause mke2fs to specify the -F
      option twice (it is already set once); this is truly dangerous
    * **blocks_per_group**: number of blocks in a block group
    * **number_of_groups**: ext4 option for a virtual block group
    * **bytes_per_inode**: set the bytes/inode ratio
    * **inode_size**: size of the inode
    * **journal**: set to True to create a journal (default on ext3/4)
    * **journal_opts**: options for the fs journal (comma separated)
    * **blocks_file**: read bad blocks from file
    * **label**: label to apply to the file system
    * **reserved**: percentage of blocks reserved for super-user
    * **last_dir**: last mounted directory
    * **test**: set to True to not actually create the file system (mke2fs -n)
    * **number_of_inodes**: override default number of inodes
    * **creator_os**: override "creator operating system" field
    * **opts**: mount options (comma separated)
    * **revision**: set the filesystem revision (default 1)
    * **super**: write superblock and group descriptors only
    * **fs_type**: set the filesystem type (REQUIRED)
    * **usage_type**: how the filesystem is going to be used
    * **uuid**: set the UUID for the file system

    See the ``mke2fs(8)`` manpage for a more complete description of these
    options.
    �
block_size�b�check�cZdirect�DZext_opts�EZ
fragment_size�f�force�FZblocks_per_group�gZnumber_of_groups�GZbytes_per_inode�iZ
inode_size�I�journal�j�journal_opts�JZblocks_file�l�label�L�reserved�m�last_dir�M�test�n�N�o�O�r�S�T�U)Znumber_of_inodesZ
creator_os�opts�revision�superZ
usage_type�uuid��True�-� z
mke2fs -F -t �cmd.runF�Zpython_shellZmke2fszDiscarding device blockszAllocating group tableszWriting inode tableszCreating journalzWriting superblocks)�__salt__�
splitlines�
startswith�append)�deviceZfs_type�kwargs�	kwarg_mapr)�key�opt�cmd�out�ret�linerrr�mkfss�*��������	�
���
�������





r@cKs�idd�dd�dd�dd�d	d
�dd�d
d�dd�dd�dd�dd�dd�dd�dd�dd�dd �d!d"�d#d$d%��}d&}|D]&}||vrd||}||d'krW|d(|�d)�7}q>|d(|�d)||�d)�7}q>d*|�|��}td+|d,d-���}|S).a+
    Set attributes for the specified device (using tune2fs)

    CLI Example:

    .. code-block:: bash

        salt '*' extfs.tune /dev/sda1 force=True label=wildstallyns opts='acl,noexec'

    Valid options are:

    * **max**: max mount count
    * **count**: mount count
    * **error**: error behavior
    * **extended_opts**: extended options (comma separated)
    * **force**: force, even if there are errors (set to True)
    * **group**: group name or gid that can use the reserved blocks
    * **interval**: interval between checks
    * **journal**: set to True to create a journal (default on ext3/4)
    * **journal_opts**: options for the fs journal (comma separated)
    * **label**: label to apply to the file system
    * **reserved**: percentage of blocks reserved for super-user
    * **last_dir**: last mounted directory
    * **opts**: mount options (comma separated)
    * **feature**: set or clear a feature (comma separated)
    * **mmp_check**: mmp check interval
    * **reserved**: reserved blocks count
    * **quota_opts**: quota options (comma separated)
    * **time**: time last checked
    * **user**: user or uid who can use the reserved blocks
    * **uuid**: set the UUID for the file system

    See the ``mke2fs(8)`` manpage for a more complete description of these
    options.
    �maxr�count�C�error�eZ
extended_optsr
rr�groupr�intervalrrrrrrrrrr)r#Zfeaturer$Z	mmp_check�prr%Z
quota_opts�Q�timer'�ur()�userr,r-r.r/r0ztune2fs r1Fr2)r3r4)r7r8r9r)r:r;r<r=rrr�tune|sb$��������	�
���
�������rMcC�t||�}|dS)z�
    Return attributes from dumpe2fs for a specified device

    CLI Example:

    .. code-block:: bash

        salt '*' extfs.attributes /dev/sda1
    �
attributes��dump�r7�argsZfsdumprrrrO��

rOcCrN)z�
    Return block and inode info from dumpe2fs for a specified device

    CLI Example:

    .. code-block:: bash

        salt '*' extfs.blocks /dev/sda1
    �blocksrPrRrrrrU�rTrUcCsd|��}|r
|d|}iid�}td|dd���}d}d}|D]�}|s'q"|�d	�r-q"|dkrn|�d
d�}|�d�}|�d
�rN|d��|d|d<n |�d�r[|�d�s[d}nt|�dkrbq"|d��|d|d<|dk�r|�d�r�|�dd�}|�dd�}|�dd�}|�dd�}|�dd�}|��}|d}	d|	��}i|d|<|	|d|d<|d|d|d<g|d|d<q"d |vr�|�d�}|d�d!�}
|
|d|d"<q"d#|vr�|�d�}|d�d!�}||d|d$<q"|��}|d|d�|�q"|S)%z�
    Return all contents of dumpe2fs for a specified device

    CLI Example:

    .. code-block:: bash

        salt '*' extfs.dump /dev/sda1
    z	dumpe2fs z -)rOrUr1Fr2r)NZdumpe2fs�	r0z: zFilesystem features�rOrZGroupzGroup descriptor sizerU��:r-�(�)�[�]zGroup rF��range�extrazFree blocks:z, zfree blockszFree inodes:zfree inodes)r3r4r5�replace�split�len�stripr6)r7rSr<r>r=�moderFr?�compsZblkgrpZfree_blocks�inodesrrrrQ�sd





�




�rQ)N)
�__doc__�loggingZsalt.utils.platformr�	getLogger�__name__�logrr@rMrOrUrQrrrr�<module>s

c
F