%PDF- %PDF-
Mini Shell

Mini Shell

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

�
���^c@@s�dZddlmZmZmZddlZddlZddlZddlZ	ddl
Z	ddlZ	ddlZ	ddl
mZeje�ZdZd�Zd�Zd�Zd	�ZdS(
uu
Stores eauth tokens in the filesystem of the master. Location is configured by the master config option 'token_dir'
i(tabsolute_importtprint_functiontunicode_literalsN(tsixulocalfscC@sott|jdd��}tj|tjd��j��}tjj	|d|�}dj
|�}xStjj|�r�tj|tjd��j��}tjj	|d|�}qjW||d<tj
j|�}ygtjjjd��<tjjj|d��}|j|j|��Wd	QXWd	QXtj||�Wn(ttfk
rjtjd
|�iSX|S(u�
    Mint a new token using the config option hash_type and store tdata with 'token' attribute set
    to the token.
    This module uses the hash of random 512 bytes as a token.

    :param opts: Salt master config options
    :param tdata: Token data to be stored with 'token' attirbute of this dict set to the token.
    :returns: tdata with token if successful. Empty dict if failed.
    u	hash_typeumd5iu	token_diru{}.tmputokeniuw+bNu6Authentication failure: can not write token file "%s".(tgetattrthashlibtgetRt	text_typetosturandomt	hexdigesttpathtjointformattisfiletsalttpayloadtSerialtutilstfilest	set_umasktfopentwritetdumpstrenametIOErrortOSErrortlogtwarning(toptsttdatat	hash_typettoktt_pathttemp_t_pathtserialtfp_((s7/usr/lib/python2.7/site-packages/salt/tokens/localfs.pytmk_tokens&
$$
"
cC@s�tjj|d|�}tjjj|d|�s9iStjj|�sOiStjj	|�}y>tjj
j|d�� }|j|j
��}|SWdQXWn(ttfk
r�tjd|�iSXdS(u�
    Fetch the token data from the store.

    :param opts: Salt master config options
    :param tok: Token value to get
    :returns: Token data if successful. Empty dict if failed.
    u	token_dirurbNu5Authentication failure: can not read token file "%s".(RRRRRtverifyt
clean_pathRRRRRtloadstreadRRRR(RR R!R#R$R((s7/usr/lib/python2.7/site-packages/salt/tokens/localfs.pyt	get_token8s
cC@s\tjj|d|�}ytj|�iSWn'ttfk
rWtjd|�nXdS(u�
    Remove token from the store.

    :param opts: Salt master config options
    :param tok: Token to remove
    :returns: Empty dict if successful. None if failed.
    u	token_diruCould not remove token %sN(RRRtremoveRRRR(RR R!((s7/usr/lib/python2.7/site-packages/salt/tokens/localfs.pytrm_tokenPs
cC@sUg}xHtjjj|d�D]-\}}}x|D]}|j|�q6Wq W|S(uy
    List all tokens in the store.

    :param opts: Salt master config options
    :returns: List of dicts (tokens)
    u	token_dir(RRRtos_walktappend(Rtrettdirpathtdirnamest	filenamesttoken((s7/usr/lib/python2.7/site-packages/salt/tokens/localfs.pytlist_tokens`s
)
(t__doc__t
__future__RRRRRtloggingtsalt.utils.filesRtsalt.utils.pathtsalt.utils.verifytsalt.payloadtsalt.extRt	getLoggert__name__Rt__virtualname__R%R*R,R4(((s7/usr/lib/python2.7/site-packages/salt/tokens/localfs.pyt<module>s			

Zerion Mini Shell 1.0