%PDF- %PDF-
Mini Shell

Mini Shell

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

�
���^c@@s�dZddlmZmZddlZddlZddlZddlZddl	Zddl
ZddlZeje
�Zd�Zd�Zd�Zd�ZdS(u
Utility functions for minions
i(tabsolute_importtunicode_literalsNcC@s�g}tjj|dd�}tjj|�s5|Sxutj|�D]d}tjj||�}y/t||�}|dk	r�|j|�nWqEtt	fk
r�qEXqEW|S(u0
    Return the running jobs on this minion
    ucachediruprocN(
tostpathtjointisdirtlistdirt_read_proc_filetNonetappendtIOErrortOSError(toptstrettproc_dirtfn_Rtdata((s5/usr/lib/python2.7/site-packages/salt/utils/minion.pytrunningscC@s�tjjd|�}tjj|dd|d�}tjj|�}tjj|�shtj|�ntj	j
j|d��}|j|j
|��WdQXdS(u(
    Write job information to cache
    Rucachediruminion_jobsureturn.puw+bN(tsalttpayloadtSerialRRRtdirnameRtmakedirstutilstfilestfopentwritetdumps(RtjidR
tserialRtjdirtfp_((s5/usr/lib/python2.7/site-packages/salt/utils/minion.pyt
cache_jobs,s		c		C@s�tjj|�}tj�j}tj�}tjj	j
|d��n}|j�}|j�|rv|j
|�}n9ytj|�Wn!tk
r�tjd|�nXdSWdQXt|t�s�dStjjj|d�sytj|�Wn!tk
rtjd|�nXdS|jd�rE|jd�|krdSn�|jd�|kr�ytj|�Wn!tk
r�tjd|�nXdS|jd�|kr�dS|jd�gtj�D]}|j^q�krytj|�Wn!tk
rtjd|�nXdSt|�s�|jd�}|rJtjd|�nytj|�Wn!tk
r~tjd|�nXdS|S(u0
    Return a dict of JID metadata, or None
    urbuUnable to remove proc file %s.Nupidumultiprocessingujidu7PID %s exists but does not appear to be a salt process.(RRRt	threadingt
currentThreadtnameRtgetpidRRRtreadtclosetloadstremoveR
tlogtdebugRt
isinstancetdicttprocesst
os_is_runningtgett	enumeratet_check_cmdlinetwarning(	RRRtcurrent_threadtpidRtbufRtx((s5/usr/lib/python2.7/site-packages/salt/utils/minion.pyR>sb




1


cC@s�tjjj�stS|jd�}|s/tStjj	d�sEtStjj
dj|��}tjj|�svtSy;tjj
j|d��}d|j�kr�tSWdQXWnttfk
r�tSXdS(u9
    In some cases where there are an insane number of processes being created
    on a system a PID can get recycled or assigned to a non-Salt process.
    On Linux this fn checks to make sure the PID we are checking on is actually
    a Salt process.

    For non-Linux systems we punt and just return True
    upidu/procu/proc/{0}/cmdlineurbRN(RRtplatformtis_linuxtTrueR/tFalseRRRRtformattisfileRRR%RR
(RR4RR((s5/usr/lib/python2.7/site-packages/salt/utils/minion.pyR1}s 	(t__doc__t
__future__RRRtloggingR!tsalt.payloadRtsalt.utils.filestsalt.utils.platformtsalt.utils.processt	getLoggert__name__R)RR RR1(((s5/usr/lib/python2.7/site-packages/salt/utils/minion.pyt<module>s			?

Zerion Mini Shell 1.0