%PDF- %PDF-
| Direktori : /proc/thread-self/root/proc/self/root/usr/lib/python2.7/site-packages/salt/states/ |
| Current File : //proc/thread-self/root/proc/self/root/usr/lib/python2.7/site-packages/salt/states/incron.pyc |
�
���^c @@ sk d Z d d l m Z m Z m Z d d l Z e j e � Z d � Z d � Z
d d � Z d d � Z d S( u�
Management of incron, the inotify cron
==============================================
The incron state module allows for user incrontabs to be cleanly managed.
Incron declarations require a number of parameters. The parameters needed
to be declared: ``path``, ``mask``, and ``cmd``. The ``user`` whose incrontab is to be edited
also needs to be defined.
When making changes to an existing incron job, the ``path`` declaration is the unique
factor, so if an existing cron that looks like this:
.. code-block:: yaml
Watch for modifications in /home/user:
incron.present:
- user: root
- path: /home/user
- mask:
- IN_MODIFY
- cmd: 'echo "$$ $@"'
Is changed to this:
.. code-block:: yaml
Watch for modifications and access in /home/user:
incron.present:
- user: root
- path: /home/user
- mask:
- IN_MODIFY
- IN_ACCESS
- cmd: 'echo "$$ $@"'
Then the existing cron will be updated, but if the cron command is changed,
then a new cron job will be added to the user's crontab.
.. versionadded:: 0.17.0
i ( t absolute_importt print_functiont unicode_literalsNc C@ s� | j d � } | j � t d | � } | j d � rE | d } n x� | d D] } | | d k rP | d | k rP | d j d � } | j � | | k r� d St g | D] } | | k ^ q� � r� d
SqP qP Wd S( u
Return the changes
u ,u incron.list_tabu
i����u cronsu pathu cmdu masku presentu updateu absent( t splitt sortt __salt__t endswitht any( t usert patht maskt cmdt arg_maskt lstt cront cron_maskt x( ( s6 /usr/lib/python2.7/site-packages/salt/states/incron.pyt _check_cron3 s
%c C@ s� d } t d d k r% d } d } nO t d d k rD d } d } n0 t j d � d k rh d } d } n d } d } | | | f S(
uI
Returns the proper group owner and path to the incron directory
u rootu osu FreeBSDu wheelu /var/spool/incronu OpenBSDu crontabu os_familyu Solaris( t
__grains__t get( t ownert groupt crontab_dir( ( s6 /usr/lib/python2.7/site-packages/salt/states/incron.pyt _get_cron_infoK s u rootc C@ s� d j | � } i i d 6d d 6| d 6t d 6} t d r� t | | | | � } d | d <| d k r| d j | � | d <nN | d
k r� t | d <d j | � | d <n"