Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/inventory/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/inventory/data.pyo

�
�Udac@`s�ddlmZmZmZeZddlZddlmZ	ddl
mZddlm
Z
ddlmZddlmZmZddlmZdd	lmZdd
lmZe�Zdefd��YZdS(
i(tabsolute_importtdivisiontprint_functionN(t	constants(tAnsibleError(tGroup(tHost(t	iteritemststring_types(tDisplay(tcombine_vars(tbasedirt
InventoryDatacB`s�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
ddd	�Zd
�Z
d�Zd�Zd
�ZRS(s�
    Holds inventory data (host and group objects).
    Using it's methods should guarantee expected relationships and data.
    cC`s_i|_i|_i|_d|_d|_xdD]}|j|�q4W|jdd�dS(Ntallt	ungrouped(sallR(tgroupsthostst_groups_dict_cachetNonet	localhosttcurrent_sourcet	add_groupt	add_child(tselftgroup((s:/usr/lib/python2.7/site-packages/ansible/inventory/data.pyt__init__*s					
cC`s;d|_i|jd6|jd6|jd6|jd6}|S(NRRtlocaltsource(RRRRRR(Rtdata((s:/usr/lib/python2.7/site-packages/ansible/inventory/data.pyt	serialize=s	



cC`sUi|_|jd�|_|jd�|_|jd�|_|jd�|_dS(NRRRR(RtgetRRRR(RR((s:/usr/lib/python2.7/site-packages/ansible/inventory/data.pytdeserializeGs
	cC`s�|jr|j}nlt|�}d|_t|_tj}|sXd}tjd�n|j	d|�|j	dd�||_|S(Ns	127.0.0.1s/usr/bin/pythons�Unable to determine python interpreter from sys.executable. Using /usr/bin/python default. You can correct this by setting ansible_python_interpreter for localhosttansible_python_interpretertansible_connectionR(
RRtaddresstTruetimplicittsyst
executabletdisplaytwarningtset_variable(Rtpatterntnew_hostt	py_interp((s:/usr/lib/python2.7/site-packages/ansible/inventory/data.pyt_create_implicit_localhostNs					c	C`s�tjd�d|_t�}x`|jD]U}|j|}|j|j�|jdkr)|j�r)|j	d|j�q)q)Wt�}x|j
j�D]}|j|j�|j�}|jd|krt|�j
t|jd|jdg��rr|jdj|�qrnY|jsrt|�}|dksY|dkrr|jd|krr|j	d|j�qrn|jr�t|jdj�|j�|_q�q�Wx(|j|�D]}tjd|�q�Wi|_dS(s1 Ensure inventory basic rules, run after updates s(Reconcile groups and hosts in inventory.R
Riis,Found both group and host with same name: %sN(R'tdebugRRtsetRtaddtnamet
get_ancestorsRRtvaluest
get_groupst
differencetremove_hostR$tlenR
tget_varstvarstintersectionR(R(	Rtgroup_namestgRt
host_namesthosttmygroupstlengthtconflict((s:/usr/lib/python2.7/site-packages/ansible/inventory/data.pytreconcile_inventoryfs0
		
	/	+	)cC`sF|jj|d�}|dkrB|tjkrB|j|�}n|S(s; fetch host object using name deal with implicit localhost N(RRRtCt	LOCALHOSTR-(Rthostnamet
matching_host((s:/usr/lib/python2.7/site-packages/ansible/inventory/data.pytget_host�scC`s�|r�t|t�s4tdt|�|f��n||jkr�t|�}|j|jkr�||j|j<i|_tj	d|�n|j}q�tj	d|�ntd|��|S(sM adds a group to inventory if not there already, returns named actually used s@Invalid group name supplied, expected a string but got %s for %ssAdded group %s to inventorysgroup %s already in inventorys+Invalid empty/false group name provided: %s(
t
isinstanceRRttypeRRR1RR'R.(RRR<((s:/usr/lib/python2.7/site-packages/ansible/inventory/data.pyR�s	cC`sh||jkr6|j|=tjd|�i|_nx+|jD] }|j|}|j|�q@WdS(NsRemoved group %s from inventory(RR'R.RRtremove_group(RRR>th((s:/usr/lib/python2.7/site-packages/ansible/inventory/data.pyRJ�s

cC`s�|r�t|t�s4tdt|�|f��nd
}|rr||jkr_|j|}qrtd|��n||jkrwt||�}||j|<|jr�|j	|d|j�|j	|dt
|j��n&|j	|dd
�|j	|dd
�tjd|�|t
jkr�|jd
krT|j||_tjd|�qttjd||jjf�q�n
|j|}|r�|j|�i|_tjd||f�q�ntd	|��|S(sD adds a host to inventory and possibly a group if not there already s?Invalid host name supplied, expected a string but got %s for %ss$Could not find group %s in inventorytinventory_filet
inventory_dirsAdded host %s to inventorysSet default localhost to %ssMA duplicate localhost-like entry was found (%s). First found localhost was %ssAdded host %s to group %ss$Invalid empty host name provided: %sN(RHRRRIRRRRRR)RR'R.RCRDRtvvvvR(R1tadd_hostR(RR>RtportR<RK((s:/usr/lib/python2.7/site-packages/ansible/inventory/data.pyRO�s:
	#

	cC`sT|j|jkr"|j|j=nx+|jD] }|j|}|j|�q,WdS(N(R1RRR6(RR>RR<((s:/usr/lib/python2.7/site-packages/ansible/inventory/data.pyR6�s

cC`sy||jkr|j|}n/||jkr>|j|}ntd|��|j||�tjd||f�dS(s) sets a variable for an inventory object s)Could not identify group or host named %ss
set %s for %sN(RRRR)R'R.(Rtentitytvarnametvaluet
inv_object((s:/usr/lib/python2.7/site-packages/ansible/inventory/data.pyR)�scC`s�t}||jkr�|j|}||jkrJ|j|j|�}n8||jkrr|j|j|�}ntd|��i|_tjd||f�ntd|��|S(s Add host or group to group s %s is not a known host nor groupsGroup %s now contains %ss%s is not a known group(	tFalseRtadd_child_groupRRORRR'R.(RRtchildtaddedR<((s:/usr/lib/python2.7/site-packages/ansible/inventory/data.pyRs
	cC`s\|jsUxIt|j�D]5\}}g|j�D]}|j^q2|j|<qWn|jS(s�
        We merge a 'magic' var 'groups' with group name keys and hostname list values into every host variable set. Cache for speed.
        (RRRt	get_hostsR1(Rt
group_nameRRK((s:/usr/lib/python2.7/site-packages/ansible/inventory/data.pytget_groups_dicts	0N(t__name__t
__module__t__doc__RRRR-RBRGRRJRROR6R)RR[(((s:/usr/lib/python2.7/site-packages/ansible/inventory/data.pyR$s		
			,			-			
	(t
__future__RRRRIt
__metaclass__R%tansibleRRCtansible.errorsRtansible.inventory.groupRtansible.inventory.hostRtansible.module_utils.sixRRtansible.utils.displayR	tansible.utils.varsR
tansible.utils.pathRR'tobjectR(((s:/usr/lib/python2.7/site-packages/ansible/inventory/data.pyt<module>s	

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