403Webshell
Server IP : 198.38.94.13  /  Your IP : 216.73.217.33
Web Server : Apache
System : Linux d4744.dxb1.stableserver.net 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64
User : revivere ( 1140)
PHP Version : 8.2.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/saltstack/salt/lib/python3.10/site-packages/salt/states/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/saltstack/salt/lib/python3.10/site-packages/salt/states/__pycache__/blockdev.cpython-310.pyc
o

;j(�@s`dZddlZddlZddlZddlZddlZdZe�e	�Z
dd�Zdd�Zdd
d�Z
dd
�ZdS)a8
Management of Block Devices

A state module to manage blockdevices

.. code-block:: yaml


    /dev/sda:
      blockdev.tuned:
        - read-only: True

    master-data:
      blockdev.tuned:
        - name: /dev/vg/master-data
        - read-only: True
        - read-ahead: 1024


.. versionadded:: 2014.7.0
�NZblockdevcCsdtvrtSdd�t�fS)zI
    Only load this module if the disk execution module is available
    �	disk.tuneFz@Cannot load the {} state module: disk execution module not found)�__salt__�__virtualname__�format�rr�H/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/blockdev.py�__virtual__$s��rcKshid|dd�}ddddd�}td|�s"d	|�d
�|d<d|d
<|Stdr4d	|�d�|d<d|d
<|Std|�}td|fi|��}i}|D]B}||vr�||}||||kr�t||t�rn||dk}	||dk}
n||}	||}
|dkr�|	}	|
}
d|	�d|
��||<qH|r�|r�d|�d�|d<||d<|Sd|�d�|d<|Sd|��|d<d|d
<|S)a9
    Manage options of block device

    name
        The name of the block device

    opts:
      - read-ahead
          Read-ahead buffer size

      - filesystem-read-ahead
          Filesystem Read-ahead buffer size

      - read-only
          Set Read-Only

      - read-write
          Set Read-Write
    �T��changes�comment�name�resultZgetraZgetfraZgetro)z
read-aheadzfilesystem-read-aheadz	read-only�
read-writezfile.is_blkdev�Changes to z' cannot be applied. Not a block device.rFr�test� will be applied Nz	disk.dumpr�1rz
Changed from z to z
Block device z successfully modified rz already in correct statezFailed to modify block device )r�__opts__�
isinstance�bool)r
�kwargs�retZ	kwarg_map�currentrZ	changeset�keyZswitch�old�newrrr�tuned2sR� ����r�ext4FcKsTi|�d|��|dd�}tj�|�s|�d�|d<|St|�}||kr)d|d<|Stjj�d|���s@d	|��|d<d|d<|Std
rRd|�d�|d<d
|d<|Std||fd|i|��t	d�D]9}t
�d|d�t|�}||kr�|�d|��|d<||d�|d<d|d<|S|dkr�t
�d�t�
d�qcd|��|d<d|d<|S)a�
    Manage filesystems of partitions.

    name
        The name of the block device

    fs_type
        The filesystem it should be formatted as

    force
        Force mke2fs to create a filesystem, even if the specified device is
        not a partition on a block special device. This option is only enabled
        for ext and xfs filesystems

        This option is dangerous, use it with caution.

        .. versionadded:: 2016.11.0
    z already formatted with Fr
z does not existrTrzmkfs.zInvalid fs_type: rrrNzdisk.format�force�
z!Check blk fstype attempt %d of 10�z has been formatted with )rrrr	zWaiting 3s before next check�zFailed to format )�os�path�exists�	_checkblk�salt�utils�whichrr�range�log�info�time�sleep)r
Zfs_typerrrZ
current_fs�irrr�	formattedusH�
r0cCs(tdddddd|gdd�}|sd	S|S)
z=
    Check if the blk exists and return its fstype if ok
    zcmd.runZblkidz-o�valuez-sZTYPET)Zignore_retcoder	)r)r
Zblkrrrr&�s�r&)rF)�__doc__�loggingr#Zos.pathr-Zsalt.utils.pathr'r�	getLogger�__name__r+rrr0r&rrrr�<module>s

CH

Youez - 2016 - github.com/yon3zu
LinuXploit