%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //lib/python2.7/site-packages/salt/modules/at_solaris.pyc

�
���^c@@s�dZddlmZmZmZddlZddlZddlZddlZddl	m
Z
ddlmZddl
ZddlZddlZddlZeje�ZdZd�Zdd�Zd	�Zd
�Zd�Zd�Zd
�ZdS(u
Wrapper for at(1) on Solaris-like systems

.. note::
    we try to mirror the generic at module
    where possible

:maintainer:    jorge schrauwen <sjorge@blackdot.be>
:maturity:      new
:platform:      solaris,illumos,smartso

.. versionadded:: 2017.7.0
i(tabsolute_importtprint_functiontunicode_literalsN(tmap(tsixuatcC@sltjjj�stdfStjjjd�s^tjjjd�s^tjjjd�rhtdfStS(u;
    We only deal with Solaris' specific version of at
    u7The at module could not be loaded: unsupported platformuatuatquatrmu7The at module could not be loaded: at command not found(tsalttutilstplatformtis_sunostFalsetpathtwhicht__virtualname__(((s;/usr/lib/python2.7/site-packages/salt/modules/at_solaris.pyt__virtual__&s

cC@stg}tdd�}|ddkr5i|dd6S|ddkrPi|d	6Stjd
�}x|dj�D]�}d}|jd�r�qpn|j�}d
j|dd!�}|d}tjtj	|d�dd!�j
�jd�}	|	j|d�|	j|d�tj
|�}djd|�}
td|
�r�tjjj|
d��U}xK|D]C}tjjj|�}|j|�}|rc|j�d}qcqcWWdQXn|s|ji|d6|	dd6|	dd6|	dd6|	dd6|d 6�qp|rp|||gkrp|ji|d6|	dd6|	dd6|	dd6|	dd6|d 6�qpqpWi|d	6S(!u�
    List all queued and running jobs or only those with
    an optional 'tag'.

    CLI Example:

    .. code-block:: bash

        salt '*' at.atq
        salt '*' at.atq [tag]
        salt '*' at.atq [job number]
    ucmd.run_alluatquretcodeiustderruerrorustdoutuno files in queue.ujobsu^### SALT: (\w+)uu Ranku iiiu%b %d, %Y %H:%MuTiu/var/spool/cron/atjobs/{job}tjobufile.file_existsurNujobudateutimeiuqueueiuuserutag(t__salt__tretcompilet
splitlinest
startswithtsplittjointdatetimettimetstrptimet	isoformattappendRt	text_typetformatRRtfilestfopentstringutilst
to_unicodetmatchtgroups(ttagtjobstrestjob_kw_regextlinetjob_tagttmpttimestrRtspecst
atjob_filetatjob((s;/usr/lib/python2.7/site-packages/salt/modules/at_solaris.pytatq3sH

"			
 &$&(cG@s"|siigd6dd6d6S|ddkr�t|�dkr�ttttgt|d�dD]}|d^qb���}ii|d6|dd6d6}q^ttttgt�dD]}|d^q����}ii|d6dd6d6}ndttttgt�dD] }|d|kr|d^q���}ii|d6dd6d6}x||ddD]l}tdd	jd
|��}|ddkrmd|dkr�i|dd<n|d
|dd|<qmqmWd|dkrx.|ddD]}|ddj|�q�Wn|S(u�
    Remove jobs from the queue.

    CLI Example:

    .. code-block:: bash

        salt '*' at.atrm <jobid> <jobid> .. <jobid>
        salt '*' at.atrm all
        salt '*' at.atrm all [tag]
    uremovedutagujobsiualliujobucmd.run_allu
atrm {job}RuretcodeufailedustderrN(	tNonetlentlistRtstrR.RRtremove(targstjtoptstrettiRtres_job((s;/usr/lib/python2.7/site-packages/salt/modules/at_solaris.pytatrm}s,
@"9 )cO@s9t|�dkrigd6Sd|krOdj|ddj|d��}ndj|d�}i|d6td6}d	|kr�|d	|d	<ntd
djd|d
�|�}|dd
kr�d|dkr�igd6dd6Sigd6|dd6S|dj�d}tj|j�d�}t	|�SdS(uc
    Add a job to the queue.

    The 'timespec' follows the format documented in the
    at(1) manpage.

    CLI Example:

    .. code-block:: bash

        salt '*' at.at <timespec> <cmd> [tag=<tag>] [runas=<user>]
        salt '*' at.at 12:05am '/sbin/reboot' tag=reboot
        salt '*' at.at '3:05am +3 days' 'bin/myscript' tag=nightly runas=jim
    iujobsutagu### SALT: {0}
{1}u iustdinupython_shellurunasucmd.run_alluat "{timespec}"ttimespeciuretcodeubad time specificationustderruinvalid timespecuerrorN(
R0RRR	RRRRRR.(R4tkwargststdint
cmd_kwargsR%tjobid((s;/usr/lib/python2.7/site-packages/salt/modules/at_solaris.pytat�s$&
	c	C@s�djd|�}td|�r{tjjj|d��<}djg|j�D]}tjjj	|�^qP�SWdQXnidj|�d6SdS(	u�
    Print the at(1) script that will run for the passed job
    id. This is mostly for debugging so the output will
    just be text.

    CLI Example:

    .. code-block:: bash

        salt '*' at.atc <jobid>
    u/var/spool/cron/atjobs/{job}Rufile.file_existsuruNuinvalid job id '{0}'uerror(
RRRRRRRt	readlinesRR (R?R,trfhtx((s;/usr/lib/python2.7/site-packages/salt/modules/at_solaris.pytatc�s
			5cK@srg}|jdd�}|jdd�}|jdd�}|jdd�}|jdd�}|jdd�}|jdd�}|r�ttj|��dkr�d	j|�}nt�d
}	|	s�i|d
6Sxq|	D]i}
|s�n||
dkr�nq�|s
n||
dkr�nq�|s)n2djt|��|
d
jd�dkr�nq�|sdn2djt|��|
d
jd�dkr�nq�|s�n2djt|��|
djd�dkr�nq�|s�n2djt|��|
djd�dkr�nq�|sn#||
djd�dkr�nq�|j	|
�q�W|sgd}i|d
6|d6Si|d
6S(u 
    Return match jobs list
    urunasutaguhouruminuteudayumonthuyeariu20{0}ujobsuuseru{0:02d}utimeu:iiudateu-u"No match jobs or time format errorunoteN(
tgetR/R0RRRR.tintRR(R<R$trunasR#thourtminutetdaytmonthtyeartjobinfoRtnote((s;/usr/lib/python2.7/site-packages/salt/modules/at_solaris.pyt_atq�sl!

,,,,cK@s|sidd6St|�S(u%
    Check the job from queue.
    The kwargs dict include 'hour minute day month year tag runas'
    Other parameters will be ignored.

    CLI Example:

    .. code-block:: bash

        salt '*' at.jobcheck runas=jam day=13
        salt '*' at.jobcheck day=13 month=12 year=13 tag=rose
    uYou have given a conditionuerror(RO(R<((s;/usr/lib/python2.7/site-packages/salt/modules/at_solaris.pytjobcheck@s(t__doc__t
__future__RRRRRRtloggingtsalt.ext.six.movesRtsalt.extRtsalt.utils.filesRtsalt.utils.pathtsalt.utils.platformtsalt.utils.stringutilst	getLoggert__name__tlogRR
R/R.R:R@RDRORP(((s;/usr/lib/python2.7/site-packages/salt/modules/at_solaris.pyt<module>s(	
J	.	,		Q

Zerion Mini Shell 1.0