%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python2.7/site-packages/salt/states/
Upload File :
Create Path :
Current File : //lib/python2.7/site-packages/salt/states/incron.pyo

�
���^c@@skdZddlmZmZmZddlZeje�Zd�Z	d�Z
dd�Zdd�ZdS(	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(tabsolute_importtprint_functiontunicode_literalsNc	C@s�|jd�}|j�td|�}|jd�rE|d }nx�|dD]}||dkrP|d|krP|djd�}|j�||kr�d	Stg|D]}||k^q��r�d
SqPqPWdS(u
    Return the changes
    u,uincron.list_tabu
i����ucronsupathucmdumaskupresentuupdateuabsent(tsplittsortt__salt__tendswithtany(	tusertpathtmasktcmdtarg_masktlsttcront	cron_masktx((s6/usr/lib/python2.7/site-packages/salt/states/incron.pyt_check_cron3s

 
%cC@s�d}tddkr%d}d}nOtddkrDd}d}n0tjd�d	krhd}d}nd}d}|||fS(
uI
    Returns the proper group owner and path to the incron directory
    urootuosuFreeBSDuwheelu/var/spool/incronuOpenBSDucrontabu	os_familyuSolaris(t
__grains__tget(townertgrouptcrontab_dir((s6/usr/lib/python2.7/site-packages/salt/states/incron.pyt_get_cron_infoKs			urootc	C@s�dj|�}iid6dd6|d6td6}tdr�t||||�}d|d<|dkr|d	j|�|d<nN|d
kr�t|d<dj|�|d<n"|dkr�d
j|�|d<n|Stdd|d|d|d|�}|d
krdj|�|d<|S|dkrMdj||�|d<i||6|d<|S|dkr�dj|�|d<i||6|d<|Sdj|||�|d<t|d<|S(u�
    Verifies that the specified incron job is present for the specified user.
    For more advanced information about what exactly can be set in the cron
    timing parameters, check your incron system's documentation. Most Unix-like
    systems' incron documentation can be found via the incrontab man page:
    ``man 5 incrontab``.

    name
        Unique comment describing the entry

    path
        The path that should be watched

    user
        The name of the user who's crontab needs to be modified, defaults to
        the root user

    mask
        The mask of events that should be monitored for

    cmd
        The cmd that should be executed

    u,uchangesuucommentunameuresultutestuabsentuIncron {0} is set to be addedupresentuIncron {0} already presentuupdateuIncron {0} is set to be updateduincron.set_jobRR	R
Runewu#Incron {0} added to {1}'s incrontabuupdateduIncron {0} updatedu8Incron {0} for user {1} failed to commit with error 
{2}N(tjointTruet__opts__RtNonetformatRtFalse(tnameR	R
RRtrettstatustdata((s6/usr/lib/python2.7/site-packages/salt/states/incron.pytpresent_sL


	

	
c
C@s^dj|�}i|d6td6id6dd6}tdr�t||||�}d|d<|dkr�t|d<d	j|�|d<n.|d
ks�|dkr�dj|�|d<n|Std
d|d|d|d|�}|dkrdj|�|d<|S|dkr7dj||�|d<i||6|d<|Sdj|||�|d<t|d<|S(u�
    Verifies that the specified incron job is absent for the specified user; only
    the name is matched when removing a incron job.

    name
        Unique comment describing the entry

    path
        The path that should be watched

    user
        The name of the user who's crontab needs to be modified, defaults to
        the root user

    mask
        The mask of events that should be monitored for

    cmd
        The cmd that should be executed

    u,unameuresultuchangesuucommentutestuabsentuIncron {0} is absentupresentuupdateuIncron {0} is set to be removedu
incron.rm_jobRR	R
RuIncron {0} already absenturemovedu%Incron {0} removed from {1}'s crontabu7Incron {0} for user {1} failed to commit with error {2}N(RRRRRRRR(RR	R
RRRR R!((s6/usr/lib/python2.7/site-packages/salt/states/incron.pytabsent�sB


	

	
(
t__doc__t
__future__RRRtloggingt	getLoggert__name__tlogRRR"R#(((s6/usr/lib/python2.7/site-packages/salt/states/incron.pyt<module>+s		I

Zerion Mini Shell 1.0