Anons79 Mini Shell

Directory : /proc/self/root/lib/python2.7/site-packages/ansible/module_utils/
Upload File :
Current File : //proc/self/root/lib/python2.7/site-packages/ansible/module_utils/azure_rm_common_ext.pyc

�
�Udac@s\ddlmZddlZddlmZmZddlmZdefd��YZdS(i����(tAzureRMModuleBaseN(t_camel_to_snaket_snake_to_camel(tstring_typestAzureRMModuleBaseExtcBs5eZd�Zd�Zd�Zd�Zd�ZRS(c
Cs�t|t�r7x!|D]}|j|||�qWdSx�|j�D]�}|j|�}|seqDn||jdd�}|r�|dkr�t|t�}q�|j||�}|||<n||jdd�}|dkr�|j	d�r�qDn|dkrd}n|j
d�}	|	ddkr:|	jd�n|}
|j|�}x1t|	�d	kr�|
j
|	jd�i�}
qRW|	ddkr�|	dn|}||
|<||jd
�rD|j||jd
�|
||d	�qDqDWdS(Ntpatterntcamelizetdispositiont*it/s/*titoptions(t
isinstancetlisttinflate_parameterstkeystgettNoneRtTruetnormalize_resource_idt
startswithtsplittpoptlent
setdefault(
tselftspectbodytleveltitemtnametparamRRtpartsttarget_dicttelemt
targetName((sL/usr/lib/python2.7/site-packages/ansible/module_utils/azure_rm_common_ext.pyR
s<

	 
cCsqi}t|t�r�|jd�}t|�dkrC||d<q�|jd�}t|�t|�krnd	Sx�tt|��D]Y}||jd�r�|||||dd!<q�||j�||j�kr�d	Sq�Wnt|t�r�|}nd	S|j	d�s|j
|d<n|j	d�s;|j|d<nx&|D]}d|d|krBd	SqBW|j|�S(
s�
        Return a proper resource id string..

        :param resource_id: It could be a resource name, resource id or dict containing parts from the pattern.
        :param pattern: pattern of resource is, just like in Azure Swagger
        R	iRt{i����tsubscription_idtresource_groupt}N(
RRRRRtrangeRtlowertdictRR%R&tformat(RtvalueRt
value_dicttvalue_partst
pattern_partstitk((sL/usr/lib/python2.7/site-packages/ansible/module_utils/azure_rm_common_ext.pyR1s0
 	
cCsNi}i}|j|jjd|�||jd<|j|||d|j�S(s
        Return True if something changed. Function will use fields from module_arg_spec to perform dependency checks.
        :param old_params: old parameters dictionary, body from Get request.
        :param new_params: new parameters dictionary, unpacked module parameters.
        R
t	modifiers(tcreate_compare_modifierstmodulet
argument_spectresultstdefault_compare(Rt
old_paramst
new_paramsR2tresult((sL/usr/lib/python2.7/site-packages/ansible/module_utils/azure_rm_common_ext.pytidempotency_checkVs

c
Csx|j�D]}||}|jdt�}|jdd�}|jdd�}|dkrhd}n|t|�dkr�dnd	|jd|�|d
dkr�dnd	}	|dks�|r�i|d6|d6||	<n|jd�r
|j|jd�|	|�q
q
WdS(
Nt	updatablet
comparisontdefaultRRR	s/*iR
ttypeR
R(RRRRtreplaceR3(
Rtarg_spectpathR:R1toR<R=Rtp((sL/usr/lib/python2.7/site-packages/ansible/module_utils/azure_rm_common_ext.pyR3bs
	/c

sI|dkrtSt|t�r#t}t|t�sV|djd|d�t}n�x�t|j��t|j��BD]�}|j|d�}|j|d�}	|dkr�t|	t�r|	||<|djd|d|d�qqy|j	|||	|d||�syt}qyqyW|St|t
�r�t}t|t
�s`t|�t|�kr�|djd|d�t}nt|d	t�r<d�d
|d	kr�d
|d	kr�d
�qTd|d	kr�d|d	kr�d�qTtt
|d	���t|d�fd
��}t|d�fd��}nt|�}t|�}xJtt|��D]6}
|j	|||
||
|d|�sgt}qgqgW|S|j|i�jdt�}|j|i�jdd�}|dkr�tS|dks	|dkrEt|t�r�t|t�r�|j�}|j�}q�n`|dkr�t|t�r�t|t�r�|jdd�j�}|jdd�j�}q�nt|�t|�krA|djd|dt|�dt|�dt|��|rtS|jjd|dt|�dt|�d�tSntSdS( s]
            Default dictionary comparison.
            This function will work well with most of the Azure resources.
            It correctly handles "location" comparison.

            Value handling:
                - if "new" value is None, it will be taken from "old" dictionary if "incremental_update"
                  is enabled.
            List handling:
                - if list contains "name" field it will be sorted by "name" before comparison is done.
                - if module has "incremental_update" set, items missing in the new list will be copied
                  from the old list

            Warnings:
                If field is marked as non-updatable, appropriate warning will be printed out and
                "new" structure will be updated to old value.

            :modifiers: Optional dictionary of modifiers, where key is the path and value is dict of modifiers
            :param new: New version
            :param old: Old version

            Returns True if no difference between structures has been detected.
            Returns False if difference was detected.
        tcompares	changed [s] old dict is nullsnew item was empty, using old [s][ s ]R	s*] length is different or old value is nullitidRtkeycs|j�d�S(N(RR(tx(RG(sL/usr/lib/python2.7/site-packages/ansible/module_utils/azure_rm_common_ext.pyt<lambda>�scs|j�d�S(N(RR(RH(RG(sL/usr/lib/python2.7/site-packages/ansible/module_utils/azure_rm_common_ext.pyRI�ss/*R<R=R>tignoret	sensitivetlocationt R
s] s != s - s
property 's' cannot be updated (s->t)N(RRRR*tappendtFalsetsetRRR7R
RtnexttitertsortedR(RR)R@tstrR4twarn(
RR2tnewtoldRBR:tcomparison_resultR1tnew_itemtold_itemR0R<R=((RGsL/usr/lib/python2.7/site-packages/ansible/module_utils/azure_rm_common_ext.pyR7ssp	)
'#
(	 	 	'
?4(t__name__t
__module__RRR;R3R7(((sL/usr/lib/python2.7/site-packages/ansible/module_utils/azure_rm_common_ext.pyRs
	$	%		(	t$ansible.module_utils.azure_rm_commonRtret0ansible.module_utils.common.dict_transformationsRRtansible.module_utils.sixRR(((sL/usr/lib/python2.7/site-packages/ansible/module_utils/azure_rm_common_ext.pyt<module>s

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