Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/clustering/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/clustering/znode.pyc

�
�Udac@`sddlmZmZmZeZidd6dgd6dd6ZdZd	Zdd
l	Z	dd
l
Z
d
Zy*ddl
mZddlmZeZWn#ek
r�e
j�ZeZnXdd
lmZmZddlmZd�Zd�Zddd��YZedkre�nd
S(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys-
---
module: znode
version_added: "2.0"
short_description: Create, delete, retrieve, and update znodes using ZooKeeper
description:
    - Create, delete, retrieve, and update znodes using ZooKeeper.
options:
    hosts:
        description:
            - A list of ZooKeeper servers (format '[server]:[port]').
        required: true
    name:
        description:
            - The path of the znode.
        required: true
    value:
        description:
            - The value assigned to the znode.
    op:
        description:
            - An operation to perform. Mutually exclusive with state.
    state:
        description:
            - The state to enforce. Mutually exclusive with op.
    timeout:
        description:
            - The amount of time to wait for a node to appear.
        default: 300
    recursive:
        description:
            - Recursively delete node and all its children.
        type: bool
        default: 'no'
        version_added: "2.1"
requirements:
    - kazoo >= 2.1
    - python >= 2.6
author: "Trey Perry (@treyperry)"
s;
# Creating or updating a znode with a given value
- znode:
    hosts: 'localhost:2181'
    name: /mypath
    value: myvalue
    state: present

# Getting the value and stat structure for a znode
- znode:
    hosts: 'localhost:2181'
    name: /mypath
    op: get

# Listing a particular znode's children
- znode:
    hosts: 'localhost:2181'
    name: /zookeeper
    op: list

# Waiting 20 seconds for a znode to appear at path /mypath
- znode:
    hosts: 'localhost:2181'
    name: /mypath
    op: wait
    timeout: 20

# Deleting a znode at path /mypath
- znode:
    hosts: 'localhost:2181'
    name: /mypath
    state: absent

# Creating or updating a znode with a given value on a remote Zookeeper
- znode:
    hosts: 'my-zookeeper-node:2181'
    name: /mypath
    value: myvalue
    state: present
  delegate_to: 127.0.0.1
N(tKazooClient(tKazooTimeoutError(t
AnsibleModuletmissing_required_lib(tto_bytescC`s(tdtdtdtdd�dtdtdd�dtdtdddd�d	tdtddd
ddd
g�dtd
ddg�dtdtdddd�dtdtdtdd��dt�}ts�|jdtd�dt�nt	|j
�}|ds!|jd|d�nt|�}y|j�Wn!t
k
r^|jdd�nXii|jd6|jd
6|jd6d	6i|jd6|jd6d6}d	|j
kr�|j
d	dk	r�d	nd}|j
|}|||�\}}|j�|r|j|�n
|j|�dS(Nt
argument_specthoststrequiredttypetstrtnametvaluetdefaulttoptchoicestgettwaittlisttstatetpresenttabsentttimeouti,tintt	recursivetbooltsupports_check_modetmsgskazoo >= 2.1t	exceptiontsuccesss3The connection to the ZooKeeper ensemble timed out.(R
tdicttTruetFalsetNonetKAZOO_INSTALLEDt	fail_jsonRt
KAZOO_IMP_ERRtcheck_paramstparamstKazooCommandProxytstartR	RRRRRtshutdownt	exit_json(tmoduletchecktzootcommand_dicttcommand_typetmethodtresulttresult_dict((sD/usr/lib/python2.7/site-packages/ansible/modules/clustering/znode.pytmainqsF$	




.

cC`sY|dr(|dr(itd6dd6S|drN|drNitd6dd6Sitd6S(NRRR$s+Please define an operation (op) or a state.R"s9Please choose an operation (op) or a state, but not both.(R'R&(R-((sD/usr/lib/python2.7/site-packages/ansible/modules/clustering/znode.pyR,�s
R.cB`s�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
dd
�ZRS(cC`s#||_t|jd�|_dS(NR(R2RR-tzk(tselfR2((sD/usr/lib/python2.7/site-packages/ansible/modules/clustering/znode.pyt__init__�s	cC`s|j|jjd�S(NR(t_absentR2R-(R<((sD/usr/lib/python2.7/site-packages/ansible/modules/clustering/znode.pyR�scC`s|jj|�S(N(R;texists(R<tznode((sD/usr/lib/python2.7/site-packages/ansible/modules/clustering/znode.pyR?�scC`sR|jj|jjd�}tit|�d6|d6dd6|jjdd6fS(NRtcounttitemssRetrieved znodes in path.R"R@(R;tget_childrenR2R-R&tlen(R<tchildren((sD/usr/lib/python2.7/site-packages/ansible/modules/clustering/znode.pyR�s!cC`s$|j|jjd|jjd�S(NRR(t_presentR2R-(R<((sD/usr/lib/python2.7/site-packages/ansible/modules/clustering/znode.pyR�scC`s|j|jjd�S(NR(t_getR2R-(R<((sD/usr/lib/python2.7/site-packages/ansible/modules/clustering/znode.pyR�scC`s|jj�|jj�dS(N(R;tstoptclose(R<((sD/usr/lib/python2.7/site-packages/ansible/modules/clustering/znode.pyR0�s
cC`s|jj�dS(N(R;R/(R<((sD/usr/lib/python2.7/site-packages/ansible/modules/clustering/znode.pyR/�scC`s$|j|jjd|jjd�S(NRR(t_waitR2R-(R<((sD/usr/lib/python2.7/site-packages/ansible/modules/clustering/znode.pyR�scC`sc|j|�rG|jj|d|jjd�titd6dd6fStitd6dd6fSdS(NRtchangedsThe znode was deleted.R"sThe znode does not exist.(R?R;tdeleteR2R-R&R'(R<R@((sD/usr/lib/python2.7/site-packages/ansible/modules/clustering/znode.pyR>�s cC`s�|j|�r�|jj|�\}}i}xWt|�D]I}|jd�s:t||�}t|ttf�r�|||<q�q:q:Wt	idd6|d6|d6|d6f}nt
idd6f}|S(Nt_sThe node was retrieved.R"R@Rtstats"The requested node does not exist.(R?R;Rtdirt
startswithtgetattrt
isinstanceRRR&R'(R<tpathRtzstatt	stat_dicttitattrR8((sD/usr/lib/python2.7/site-packages/ansible/modules/clustering/znode.pyRG�scC`s�|j|�r�|jj|�\}}||krr|jj|t|��titd6dd6|d6|d6fStitd6dd6|d6|d6fSnE|jj|t|�dt�titd6dd6|d6|d6fSdS(	NRKsUpdated the znode value.R"R@RsNo changes were necessary.tmakepathsCreated a new znode.(R?R;RtsetRR&R'tcreate(R<RSRt
current_valueRT((sD/usr/lib/python2.7/site-packages/ansible/modules/clustering/znode.pyRF�s)icC`s�tj�|}xQtj�|krc|j|�rStidd6|d6|d6fStj|�qWtidd6|d6|d6fS(Ns0The node appeared before the configured timeout.R"R@Rs7The node did not appear before the operation timed out.(ttimeR?R&tsleepR'(R<RSRtintervaltlim((sD/usr/lib/python2.7/site-packages/ansible/modules/clustering/znode.pyRJ�s
(t__name__t
__module__R=RR?RRRR0R/RR>RGRFRJ(((sD/usr/lib/python2.7/site-packages/ansible/modules/clustering/znode.pyR.�s												
t__main__((t
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLESR\t	tracebackR(R+tkazoo.clientRtkazoo.handlers.threadingR	R&R)tImportErrort
format_excR'tansible.module_utils.basicR
Rtansible.module_utils._textRR:R,R.R`(((sD/usr/lib/python2.7/site-packages/ansible/modules/clustering/znode.pyt<module>s.


**


	2	
R

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]