%PDF- %PDF-
Direktori : /lib/python2.7/site-packages/salt/states/ |
Current File : //lib/python2.7/site-packages/salt/states/disk.pyo |
� ���^c @@ s` d Z d d l m Z m Z m Z d d l m Z d g Z d d d � Z d d e d � Z d S( u� Disk monitoring state Monitor the state of disk resources. The ``disk.status`` function can be used to report that the used space of a filesystem is within the specified limits. .. code-block:: sls used_space: disk.status: - name: /dev/xda1 - maximum: 79% - minimum: 11% It can be used with an ``onfail`` requisite, for example, to take additional action in response to or in preparation for other states. .. code-block:: sls storage_threshold: disk.status: - name: /dev/xda1 - maximum: 97% clear_cache: cmd.run: - name: rm -r /var/cache/app - onfail: - disk: storage_threshold To use kilobytes (KB) for ``minimum`` and ``maximum`` rather than percents, specify the ``absolute`` flag: .. code-block:: sls used_space: disk.status: - name: /dev/xda1 - minimum: 1024 KB - maximum: 1048576 KB - absolute: True i ( t absolute_importt print_functiont unicode_literals( t string_typesu statusu %c C@ s� d } y5 t | t � r. | j d | � } n t | � } Wn* t t f k rg | d j | � 7} nO Xt | � d k r� | | d k s� | | d k r� | d j | | � 7} q� n | | f S( up Validate the named integer within the supplied limits inclusive and strip supplied unit characters u u u {0} must be an integer i i i u* {0} must be in the range [{1[0]}, {1[1]}] ( t isinstanceR t stript intt TypeErrort ValueErrort formatt len( t namet valuet limitsR t comment( ( s4 /usr/lib/python2.7/site-packages/salt/states/disk.pyt _validate_int8 s c C@ sL i | d 6t d 6d d 6i d 6i d 6} t d � } | | k r` t | d <| d c d 7<| S| d k r� | s� t d | d d g � \ } } n t d | d d �\ } } | d c | 7<n | d k r"| s� t d | d d g � \ } } n t d | d d �\ } } | d c | 7<n | d k r\| d k r\| | k r\| d c d 7<q\n | d rj| S| r�t | | d � } n t | | d j d � � } | | | d <| r�d n d } | d k r�| | k r�d j | | | � | d <| Sn | d k r4| | k r4d j | | | � | d <| Sn d | d <t | d <| S( u� Return the current disk usage stats for the named mount point name Disk mount with which to check used space maximum The maximum disk utilization minimum The minimum disk utilization absolute By default, the utilization is measured in percentage. Set the `absolute` flag to use kilobytes. .. versionadded:: 2016.11.0 u nameu resultu u commentu changesu datau disk.usageu Named disk mount not present u maximumi id R u KBu minimumu"