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/basic.pyc

�
�Udac,@`s	ddlmZmZmZidd6dd6dd6dd	6d
d6dd
6dd6dd6dd6dd6dd6dd6dd6dd6dd6d d!6d"d#6d$d%6d&d'6d(d)6Zdd*lZdd*lZdd*lZdd*lZdd*l	Z	dd*l
Z
dd*lZdd*lZdd*l
Z
dd*lZdd*lZdd*lZdd*lZdd*lZdd*lZdd*lZdd*lZdd*lZdd*lZdd*lZdd*lZdd*lZdd+lmZdd,lmZmZydd*l Z e!Z"Wne#k
re$Z"nXydd-l%m&Z&e!Z'Wne#k
r?e$Z'nXe$Z(ydd*l)Z)e!Z(Wne#k
ronXe*e+�Z,dd.l-m.Z.d/d0l/m0Z0m1Z1m2Z2dd1l3m4Z4m5Z6m7Z8dd2l9m:Z:m;Z;m<Z<m=Z=ydd3l>m?Z?Wn9e#k
r5Z@eAd4jBe0e@���ejCd/�nXeD�ZEy�dd*lFZFx0d5d6fD]"ZGeHeFeGe+�ZIeIr}Pnq[WeIe+kr�d7d8d9d:d;d<fZInx!eID]ZJeHeFeJ�eEeJ<q�WyeFjK�Wn!eLk
r�eEjMd7e+�nXWn^eNk
r_dd*lOZOieOjOd86ZEydd*lKZKeKjKeEd7<WneNk
r[nXnXdd=lPmQZQmRZRmSZSmTZTmUZUmVZVmWZWdd>lXmYZYdd?lZm[Z\m]Z^m_Z`maZambZbmcZcdd@ldmeZemfZfmgZgddAlhmiZimjZjddBlkmlZlmmZmmnZnmoZompZpddClqmrZrmsZsmtZtmuZumvZvmwZwmxZxmyZyddDlzm{Z{m|Z|m}Z}ddEl~mZm�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�ddFl�m�Z�ddGl�m�Z�m�Z�m�Z�m�Z�e�eQeTfZ�ej�dHej��Z�e{Z�ye�Wne�k
r�eyZ�nXye�Wne�k
r�exZ�nXejZ�e+a�dI�Z�eDdJeDdKdL�dMeD�dNeD�dOeD�dPeD�dQeD�dReD�dSeDdTdUg�dVeD�dWeDdKdXdYe$�dZeDdKdX�d[eDd\e!�d]eD�d^eD�d_eD�d`eD�daeD�dbeDdKdXdYe$dce�ddgf��Z�ej�de�Z�ej�df�Z�ej�dg�Z�ej�dh�Z�ej�di djdkfkZ�didlfej�di ko"djfknZ�e�p0e�Z�e�rjeAdmdnj�ej�j����ejCd/�ndo�Z�dp�Z�dq�Z�dr�Z�ds�Z�dt�Z�e��du�Z�e+dv�Z�dw�Z�e+e+dx�Z�dyeNfdz��YZ�d{e�fd|��YZ�d}�Z�d*S(~i(tabsolute_importtdivisiontprint_functiontnoatimetAtappendtat
compressedtctnocowtCtnodumptdtdirsynctDtextentstet	encryptedtEt	blocksizetht	immutabletitindexedtIt
journalledtjtinlinetNtzerotstsynchronoustStnotailttt	blockroottTtundeletetut
compressedrawtXtcompresseddirtytZN(tdeque(tchaintrepeat(tjournal(t	selectorsi(t	to_nativetto_bytestto_text(tjsonifytcontainer_to_bytestcontainer_to_text(tlenient_lowercasetbytes_to_humanthuman_to_bytestSIZE_RANGES(tjsonsJ
{{"msg": "Error: ansible requires the stdlib json: {0}", "failed": true}}tavailable_algorithmst
algorithmstmd5tsha1tsha224tsha256tsha384tsha512(tKeysViewtMappingtMutableMappingtSequencetMutableSequencetSett
MutableSet(tget_bin_path(t
_PERM_BITSt_EXEC_PERM_BITSt
_DEFAULT_PERMt
is_executabletformat_attributestget_flags_from_attributes(tget_distributiontget_distribution_versiontget_platform_subclass(t
get_exceptiontliteral_eval(thandle_aliasestlist_deprecationstlist_no_log_valuest	PASS_VARSt
PASS_BOOLS(tPY2tPY3tbtbinary_typet
integer_typest	iteritemststring_typest	text_type(tmaptreducetshlex_quote(tcheck_missing_parameterstcheck_mutually_exclusivetcheck_required_argumentstcheck_required_bytcheck_required_iftcheck_required_one_oftcheck_required_togethertcount_termstcheck_type_booltcheck_type_bitstcheck_type_bytestcheck_type_floattcheck_type_inttcheck_type_jsonargtcheck_type_listtcheck_type_dicttcheck_type_pathtcheck_type_rawtcheck_type_strt	safe_eval(tget_all_subclasses(tBOOLEANStBOOLEANS_FALSEt
BOOLEANS_TRUEtbooleansB^(?:.+[-_\s])?pass(?:[-_\s]?(?:word|phrase|wrd|wd)?)(?:[-_\s].+)?$cO`s5x(|D] }|tjkrtj|SqWt�dS(s Load value from environment N(tostenvirontAnsibleFallbackNotFound(targstkwargstarg((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pytenv_fallback�s
tmodettypetrawtownertgrouptseusertseroletseleveltsetypet
attributestaliasestattrtsrctfollowtbooltdefaulttforcetcontenttno_logtbackupt
remote_srctregexpt	delimitertdirectory_modet
unsafe_writestfallbacktANSIBLE_UNSAFE_WRITESs^[-]{0,2}pass[-]?(word|wd)?s[+=-]s[^ugo]s[^rwxXstugo]iiiisy
{"failed": true, "msg": "Ansible requires a minimum of Python2 version 2.6 or Python3 version 3.5. Current version: %s"}tcC`s
tj�S(s+
    **Deprecated** Use :py:func:`platform.system` directly.

    :returns: Name of the platform the module is running on in a native string

    Returns a native string that labels the platform ("Linux", "Solaris", etc). Currently, this is
    the result of calling :py:func:`platform.system`.
    (tplatformtsystem(((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pytget_platform&s	cO`s"t|�}t||�j|�S(sV**Deprecated**: Use ansible.module_utils.common.sys_info.get_platform_subclass instead(RStsupert__new__(tclsR�R�tplatform_cls((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pytload_platform_subclass8scC`stt|��S(sQ**Deprecated**: Use ansible.module_utils.common._utils.get_all_subclasses instead(tlistt_get_all_subclasses(R�((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyRz>scC`s�t|ttf�r|}t|t�rNt}tr�t|dd�}q�n3t|t�r�t}tr�t|dd�}q�n||kr�dSx |D]}|j	|d
�}q�W|r�t|t�r�t|dddd�}q�|rt|t�rt|dddd�}q�|}n�t|t
�rpt|t�rNt|��}ng}|j
||f�|}nWt|t�r�t|t�r�t|��}n	t�}|j
||f�|}nt|t�rt|t�r�t|��}ni}|j
||f�|}n�t|ttttttf���r�t|dddd�}||krfdSx^|D]}||krmdSqmWn=t|tj�r�|j�}ntd	t|�|f��|S(s�
    Helper function for :meth:`remove_values`.

    :arg value: The value to check for strings that need to be stripped
    :arg no_log_strings: set of strings which must be stripped out of any values
    :arg deferred_removals: List which holds information about nested
        containers that have to be iterated for removals.  It is passed into
        this function so that more entries can be added to it if value is
        a container type.  The format of each entry is a 2-tuple where the first
        element is the ``value`` parameter and the second value is a new
        container to copy the elements of ``value`` into once iterated.
    :returns: if ``value`` is a scalar, returns ``value`` with two exceptions:
        1. :class:`~datetime.datetime` objects which are changed into a string representation.
        2. objects which are in no_log_strings are replaced with a placeholder
            so that no sensitive data is leaked.
        If ``value`` is a container type, returns a new empty container.

    ``deferred_removals`` is added to as a side-effect of this function.

    .. warning:: It is up to the caller to make sure the order in which value
        is passed in is correct.  For instance, higher level containers need
        to be passed in before lower level containers. For example, given
        ``{'level1': {'level2': 'level3': [True]} }`` first pass in the
        dictionary for ``level1``, then the dict for ``level2``, and finally
        the list for ``level3``.
    terrorstsurrogate_or_strictt#VALUE_SPECIFIED_IN_NO_LOG_PARAMETERt*itencodingsutf-8tsurrogate_then_replacesValue of unknown type: %s, %ss********(t
isinstanceRbR^tTrueR[R1tFalseR\R2treplaceRFRGR�RRHRItsetRDREttupleR,R_tfloatR�tNoneTypeR0tdatetimet	isoformatt	TypeError(tvaluetno_log_stringstdeferred_removalstnative_str_valuet
value_is_texttomit_met	new_valuet
stringy_value((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyt_remove_values_conditionsFs`
					'
cC`st�}g|D]}t|dd�^q}t|||�}x�|r|j�\}}t|t�r�x�|j�D](\}}t|||�}	|	||<qwWqCxj|D]b}
t|
||�}	t|t�r�|j|	�q�t|t	�r|j
|	�q�td��q�WqCW|S(s: Remove strings in no_log_strings from value.  If value is a container
    type, then remove a lot more.

    Use of deferred_removals exists, rather than a pure recursive solution,
    because of the potential to hit the maximum recursion depth when dealing with
    large amounts of data (see issue #24560).
    R�R�sKUnknown container type encountered when removing private values from output(R+R0R�tpopleftR�RDtitemsRGRRItaddR�(R�R�R�RR�told_datatnew_datatold_keytold_elemtnew_elemtelem((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyt
remove_values�s"		%	
cC`smt|ttf�r|St|t�rft|t�rIt|��}ng}|j||f�|St|t�r�t|t�r�t|��}n	t	�}|j||f�|St|t
�rt|t�r�t|��}ni}|j||f�|St|tt
ttttf���r.|St|tjtjf�rM|Stdt|�|f��dS(sW Helper method to sanitize_keys() to build deferred_removals and avoid deep recursion. sValue of unknown type: %s, %sN(R�RbR^RFRGR�RRHRIR�RDRER�R,R_R�R�R�R�tdateR�(R�R�tignore_keysR�R�((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyt_sanitize_keys_conditions�s2	'c
C`sgt�}g|D]}t|dd�^q}t||||�}x|rb|j�\}}t|t�r�x�|j�D]n\}}	||ks�|jd�r�t|	|||�||<qzt||d�}
t|	|||�||
<qzWqFxm|D]e}t||||�}t|t
�r0|j|�q�t|t�rO|j
|�q�td��q�WqFW|S(sL Sanitize the keys in a container object by removing no_log values from key names.

    This is a companion function to the `remove_values()` function. Similar to that function,
    we make use of deferred_removals to avoid hitting maximum recursion depth in cases of
    large data structures.

    :param obj: The container object to sanitize. Non-container objects are returned unmodified.
    :param no_log_strings: A set of string values we do not want logged.
    :param ignore_keys: A set of string values of keys to not sanitize.

    :returns: An object with sanitized keys.
    R�R�t_ansiblesIUnknown container type encountered when removing private values from keysN(R+R0R�R�R�RDR�t
startswithR�tNoneRGRRIR�R�(
tobjR�R�R�RR�R�R�R�R�tnew_keyR�R�((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyt
sanitize_keys�s&	%	 
cC`s�t|�}g}t|�}|}d}xM|ryy|jdd|�}Wn)tk
rw|jd|d|!�PnXd	}|}x�|s$y|jdd|�}Wntk
r�d}nXy|jd|d|�}Wq�tk
r |dkr|jd|d|!�Pn|}q�q�Xq�W|r-|jd|||!�|jdd�|jd|||d!�|}q-q-Wdj|�}|r�t||�}n|S(
s; Remove strings that look like passwords from log messages it@is://t:is********R�N(	R0tlentrindext
ValueErrortinsertR�tindextjoinR�(tdatat
no_log_valuestoutputtbegint
prev_begintseptendtsep_search_end((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pytheuristic_log_sanitizesF
	
	



cC`sgtd	k	rt}n�ttj�dkr�tjjtjd�rrttjdd�}|j	�}|j
�q�tjd}tr�|jddd�}q�n*t
r�tjj	�}ntjjj	�}|aytj|jd��}Wn(tk
rtd�tjd�nXt
r,t|�}ny|dSWn(tk
rbtd�tjd�nXd	S(
s1 read the modules parameters and store them globally.

    This function may be needed for certain very dynamic custom modules which
    want to process the parameters that are being handed the module.  Since
    this is so closely tied to the implementation of modules we cannot
    guarantee API stability for it (it may change between versions) however we
    will try not to break it gratuitously.  It is certainly more future-proof
    to call this function and consume its outputs than to implement the logic
    inside it as a copy in your own code.
    itrbsutf-8R�tsurrogateescapes�
{"msg": "Error: Module unable to decode valid JSON on stdin.  Unable to figure out what parameters were passed", "failed": true}tANSIBLE_MODULE_ARGSs�
{"msg": "Error: Module unable to locate ANSIBLE_MODULE_ARGS in json data from stdin.  Unable to figure out what parameters were passed", "failed": true}N(t
_ANSIBLE_ARGSR�R�tsystargvRtpathtisfiletopentreadtcloseR\tencodeR[tstdintbufferR:tloadstdecodeR�tprinttexittjson_dict_unicode_to_bytestKeyError(R�tfdtparams((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyt_load_paramsUs4	





cC`s^tj�}d||tjf}|r9|d|7}n|rP|d|7}n|d7}|S(NsDFailed to import the required Python library (%s) on %s's Python %s.s This is required %s.s See %s for more info.s� Please read module documentation and install in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter(R�tnodeR�t
executable(tlibrarytreasonturlthostnametmsg((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pytmissing_required_lib�s
R�cB`seZRS((t__name__t
__module__(((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyR��st
AnsibleModulecB`sReZeeeeeeeeeed�
Zed��Zd�Zeeed�Zd�Z	d�Z
d�Zd�Zdd	�Z
d
�Zed�Zd�Zd
�Zd�Zed�Zeed�Zeed�Zeed�Zeed�Zd�Zed��Zed��Zed��Zeed�Zd�Z eed�Z!eed�Z"d�Z#d�Z$eedd�Z%eed �Z&eeed!�Z'ed"�Z(ed#�Z)ed$�Z*ed%�Z+ed&�Z,eed'�Z-ed(�Z.eed)�Z/eed*�Z0d+�Z1d,�Z2d-�Z3d.�Z4d/�Z5d0�Z6d1�Z7d2�Z8d3�Z9d4�Z:d5�Z;eedd6�Z<d7�Z=d8�Z>eed9�Z?eeed:�Z@eed;�ZAd<�ZBd=�ZCd>�ZDed?�ZEd@�ZFdA�ZGeedB�ZHdC�ZIdD�ZJdE�ZKdF�ZLdG�ZMdH�ZNdI�ZOdJ�ZPedK�ZQdL�ZRdM�ZSdN�ZTdO�ZUdP�ZVdQ�ZWdR�ZXedS�ZYdT�ZZdU�Z[dV�Z\eeeeeeeeeeedWdXeeedY�Z]dZ�Z^d[�Z_e_Z`ed\�ZaebZbed]��ZcRS(^cC`sdtjjt�|_||_|	|_t|_||_	||_
|dkr]t}t}nt}||_
||_||_||_|
|_||_g|_t|_t|_d|_d|_d|_i|_g|_g|_i|_d|_i|_g|_t �|_!d|_"|rhx<t#j$�D]+\}
}|
|jkr6||j|
<q6q6Wnt%�|_&|j'�|j(�y|j)�|_Wn:t*t+fk
r�}t,dt-|��t.j/d�nX|j0�|j1�|j2|�|s|j3|�n|j4dt�i|j5d6|j6d6|j7d6|j8d	6|j9d
6|j:d6|j;d6|j<d
6|j=d6|j=d6|j>d6|j?d6|_@|s�|jA�|jB�|jC�|jD|�|jE|�|jF|
�|jG|�n|j4dt�|jH�|j
s+|jI�n|jJ�|r`|jdkr`|jKddd�ndS(s7
        Common code for quickly building an ansible module in Python
        (although you can write modules with anything that can return JSON).

        See :ref:`developing_modules_general` for a general introduction
        and :ref:`developing_program_flow_modules` for more detailed explanation.
        iR�s2
{"failed": true, "msg": "Module alias error: %s"}itpretstrR�tdictR�tintR�R�R�tjsonargR:tbytestbitsturitzfss�Setting check_invalid_arguments is deprecated and will be removed. Update the code for this module  In the future, AnsibleModule will always check for invalid arguments.tversions2.9N(RR(LRR�tbasenamet__file__t_namet
argument_spectsupports_check_modeR�t
check_modet
bypass_checksR�R�R�tcheck_invalid_argumentstmutually_exclusivetrequired_togethertrequired_one_oftrequired_iftrequired_byt
cleanup_filest_debugt_difft_socket_patht_shellt
_verbositytrun_command_environ_updatet	_warningst
_deprecationst_cleant_string_conversion_actionR�t
_legal_inputsR�t_options_contextt_tmpdirtFILE_COMMON_ARGUMENTSR�R�R�Rt_set_fallbackst_handle_aliasesR�R�R�R0R�R�t_handle_no_log_valuest
_check_localet_check_argumentst_check_mutually_exclusivet
_set_defaultst_check_type_strt_check_type_listt_check_type_dictt_check_type_boolt_check_type_intt_check_type_floatt_check_type_patht_check_type_rawt_check_type_jsonargt_check_type_bytest_check_type_bitst _CHECK_ARGUMENT_TYPES_DISPATCHERt_check_required_argumentst_check_argument_typest_check_argument_valuest_check_required_togethert_check_required_one_oft_check_required_ift_check_required_byt_handle_optionst_log_invocationt_set_cwdt	deprecate(tselfRRR�RRRR tadd_file_common_argsRR!R"t"module_set_check_invalid_argumentstktvR((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyt__init__�s�
																										






















	

cC`sn|jdkrgd}|jdk	rHtjjtjj|j��}n|dk	r�tjj|�r�ytj|dd�Wn<t	t
fk
r�}|jd|t|�f�d}q�X|jd|�ndt
j
�}ytjd|d|�}Wn<t	t
fk
r;}|jdd	||t|�f�nX|js[tjtj|�n||_n|jS(
NR�i�sCUnable to use %s as temporary directory, failing back to system: %ss�Module remote_tmp %s did not exist and was created with a mode of 0700, this may cause issues when running as another user. To avoid this, create the remote_tmp dir with the correct permissions manuallysansible-moduletmp-%s-tprefixtdirRsDFailed to create remote module tmp path at dir %s with prefix %s: %s(R0R�t_remote_tmpRR�t
expandusert
expandvarstexiststmakedirstOSErrortIOErrortwarnR0ttimettempfiletmkdtempt	fail_jsont_keep_remote_filestatexittregistertshutiltrmtree(RPtbasedirRtbasefilettmpdir((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyRk s0$	
			cC`sMt|t�r3|jj|�|jd|�ntdt|���dS(Ns[WARNING] %sswarn requires a string not a %s(R�RaR*RtlogR�R�(RPtwarning((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyR_GscC`sat|t�rG|jji|d6|d6�|jd||f�ntdt|���dS(NRRsEPRECATION WARNING] %s %ss$deprecate requires a string not a %s(R�RaR+RRlR�R�(RPRRR�tcollection_name((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyROOscC`s�|jd|jdd��}|dkr.iStjjtjj|��}t|dd�}|jdt�r�tjj|�r�tjj	|�}t
|�}n|jdd�}|jdd�}|jdd�}|jd	d�}|jd
d�}|jdd�}	|jdd�}
|||	g}|j�rL|j|
�n|j
|�}xGtt|��D]3}
|
dk	rn||
d
krn||
||
<qnqnW|jdd�}td|d|d|d|d	|d
|d|	d|
d|d|�
S(s�
        many modules deal with files, this encapsulates common
        options that the file module accepts such that it is directly
        available to all modules and they can share code.
        R�tdestR�R�R�R�R�R�R�R�R�R�t_defaultR�t	secontextN(tgetR�RR�RYRZR1R�tislinktrealpathR0tselinux_mls_enabledRtselinux_default_contexttrangeR�R(RPR�R�tb_pathR�R�R�R�R�R�R�Rqtdefault_secontextRR�((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pytload_file_common_arguments\s6$cC`s(ts
tStj�dkr tStSdS(Ni(tHAVE_SELINUXR�tselinuxtis_selinux_mls_enabledR�(RP((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyRu�s
cC`s}ts_|jd�}|dk	r[|j|�\}}}|dkr[|jdd�q[ntStj�dkrutStSdS(NtselinuxenablediRsWAborting, target uses selinux but python bindings (libselinux-python) aren't installed!i(	R{RJR�trun_commandRcR�R|tis_selinux_enabledR�(RPt	seenabledtrctoutterr((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pytselinux_enabled�scC`s/dddg}|j�r+|jd�n|S(N(R�RuR(RPtcontext((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pytselinux_initial_context�sicC`s�|j�}ts |j�r$|Sy"tjt|dd�|�}Wntk
rZ|SX|ddkro|S|djdd�}|S(NR�R�ii����iR�i(R�R{R�R|tmatchpathconR0R]tsplit(RPR�R�R�tret((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyRv�s"
cC`s�|j�}ts |j�r$|Sytjt|dd��}WnXtk
r�}|jtjkr�|j	d|dd|�q�|j	d|dd�nX|ddkr�|S|d	j
d
d�}|S(NR�R�R�Rspath %s does not exists"failed to retrieve selinux contextii����iR�i(R�R{R�R|tlgetfilecon_rawR0R]terrnotENOENTRcR�(RPR�R�R�R((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pytselinux_context�scC`sdt|dd�}|r9tjjtjj|��}ntj|�}|j}|j}||fS(NR�R�(R1RR�RYRZtlstattst_uidtst_gid(RPR�texpandRxtsttuidtgid((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pytuser_and_group�s!		cC`s�t}t|t�rt}ntjjttjjtjj	|��dd��}x(tjj
|�s~tjj|�}qWW|r�|St|dd�S(NR�R�(
R�R�R^R�RR�RtR1RYRZtismounttdirnameR2(RPR�t
path_is_bytesRx((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pytfind_mount_point�s	6c
C`s�y)tdd�}|j�}|j�Wntk
rCtdfSX|j|�}x�|D]{}|jdd�\}}}}	}
t|�t|�krZx9|j	D]+}||kr�|j
|�}t|fSq�WqZqZWtdfS(s�
        Returns a tuple containing (True, selinux_context) if the given path is on a
        NFS or other 'special' fs  mount point, otherwise the return will be (False, None).
        s/proc/mountstrt iN(R�t	readlinesR�t	ExceptionR�R�R�R�R1t_selinux_special_fsR�R�(
RPR�tft
mount_datatpath_mount_pointtlinetdevicetmount_pointtfstypetoptionstresttfstspecial_context((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pytis_special_selinux_path�s

!cC`s:ts|j�r|S|j|�}|j||t�S(N(R{R�Rvtset_context_if_differentR�(RPR�tchangedR�((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pytset_default_selinux_context�scC`sts|j�r|S|j|�r+tS|j|�}t|�}|j|�\}}|rj|}n�x�tt|��D]q}	t|�|	kr}||	dk	r�||	||	kr�||	||	<q�||	dkr�||	||	<q�q}q}W||kr|dk	r[d|kr#i|d<n||dd<d|krJi|d<n||dd<ny2|j
rktStjt
|�dj|��}
WnEtk
r�}|jd|ddt
|�d|d	|d
|�nX|
dkr�|jd|dd�nt}n|S(
NtbeforeRqtafterR�R�Rsinvalid selinux context: %stnew_contexttcur_contextt	input_wasisset selinux context failed(R{R�tcheck_file_absent_if_check_modeR�R�R�R�RwR�R�RR|tlsetfileconR0R�R]Rc(RPR�R�R�tdiffR�R�t
is_special_set
sp_contextRR�R((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyR�sD	$

	%	cC`s�|dkr|St|dd�}|rItjjtjj|��}n|j|�r\tS|j||�\}}yt	|�}	Wnat
k
r�ytj|�j
}	Wq�tk
r�t|�}|jd|dd|�q�XnX||	kr�|dk	rQd|kri|d<n||dd<d|kr@i|d<n|	|dd<n|jr^tSytj||	d	�WnEttfk
r�}
t|�}|jd|dd
t|
��nXt}n|S(NR�R�R�Rs'chown failed: failed to look up user %sR�R�R�i����schown failed: %s(R�R1RR�RYRZR�R�R�RR�tpwdtgetpwnamtpw_uidR�R2RcRtlchownR^R](RPR�R�R�R�R�Rxtorig_uidtorig_gidR�R((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pytset_owner_if_different0sB!

"

	$	c
C`s�|dkr|St|dd�}|rItjjtjj|��}n|j|�r\tS|j||�\}}yt	|�}	Wnat
k
r�ytj|�j
}	Wq�tk
r�t|�}|jd|dd|�q�XnX||	kr�|dk	rQd|kri|d<n||dd<d|kr@i|d<n|	|dd<n|jr^tSytj|d	|	�Wn3tk
r�t|�}|jd|dd
�nXt}n|S(NR�R�R�Rs(chgrp failed: failed to look up group %sR�R�R�i����schgrp failed(R�R1RR�RYRZR�R�R�RR�tgrptgetgrnamtgr_gidR�R2RcRR�R](
RPR�R�R�R�R�RxR�R�R�((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pytset_group_if_differentYsB!

"

	
	c
	C`sn|dkr|St|dd�}|rItjjtjj|��}ntj|�}|j|�rktSt	|t
�s>yt
|d�}Wq>tk
r:y|j||�}WnAtk
r�}t
|�}|jd|dddt|��nX|tj|�kr;t
|�}|jd|ddd|�q;q>Xntj|j�}	|	|krj|dk	r�d	|kr�i|d	<nd
|	|d	d<d|kr�i|d<nd
||dd<n|jr�tSy�ttd
�r�tj||�n�tjj|�stj||�n_tj|�}
tj||�tj|�}|
j|jkrwtj|tj|
j��nWn�tk
r�}tjj|�r�|jtjtjtjfkr�q1|jtjtjfkr�q1�nMtk
r0}t
|�}|jd|dddt|�dtj ��nXtj|�}tj|j�}||	krjt}qjn|S(NR�R�iR�Rs&mode must be in octal or symbolic formtdetailss6Invalid mode supplied, only permission info is allowedR�s0%03oR�R�tlchmodschmod failedt	exception(!R�R1RR�RYRZR�R�R�R�RR�t_symbolic_mode_to_octalR2RcR0tstattS_IMODEtst_modeRthasattrR�RstchmodR]R�tEACCEStEPERMtEROFSR�tELOOPt	tracebackt
format_exc(
RPR�R�R�R�R�Rxt	path_statRt	prev_modetunderlying_stattnew_underlying_stattnew_mode((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pytset_mode_if_different�sz!
&

	#!c
C`s|dkr|St|dd�}|rItjjtjj|��}n|j|�r\tS|j|�}d}|j	d�r�|d}|d}n|j
dd	�|ks�|dkr|jd
�}	|	r|	d||f|g}	t}|dk	r_d|kri|d<n|j
d�|dd
<d|krDi|d<nd||f|dd
<n|js�yE|j
|	�\}
}}|
dks�|r�td||��nWq�tk
r�}
|jdt|�dddt|
�dtj��q�Xq�qn|S(NR�R�t=t-t+iit
attr_flagsR�tchattrs%s%sR�R�R�s"Error while setting attributes: %sR�Rs
chattr failedR�R�(R�R�(R�R1RR�RYRZR�R�tget_file_attributesR�RrRJRRR�RcR2R0R�R�(RPR�R�R�R�R�Rxtexistingtattr_modtattrcmdR�R�R�R((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pytset_attributes_if_different�sB!

$

	&cC`s�i}|jdt�}|r�|d|g}y|j|�\}}}|dkr�|j�}|djdd�j�|d<|dj�|d<t|d�|d	<nWq�tk
r�q�Xn|S(
Ntlsattrs-vdiiR�R�R�RR�(RJR�RR�R�tstripROR�(RPR�R�R�R�R�R�tres((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyR�s 
c
	C`s0tj|j�}x|jd�D]}tj|�}tj|�}|jd�}|dk}|dksy|dkr�d}ntj|�r�t	d|��nx�t
|�D]s\}	}
tj|
�r�t	d|��nxB|D]:}|j|||
|�}|j
|||	||�}q�Wq�Wq"W|S(s�
        This enables symbolic chmod string parsing as stated in the chmod man-page

        This includes things like: "u=rw-x+X,g=r-x+X,o=r-x+X"
        t,iR�Rtugos$bad symbolic permission for mode: %s(R�R�R�R�tMODE_OPERATOR_REtfindalltpoptUSERS_REtmatchR�t	enumeratetPERMS_REt#_get_octal_mode_from_symbolic_permst_apply_operation_to_mode(
R�R�t
symbolic_modeR�R�tpermlisttoperstuserst	use_umasktidxtpermstusert
mode_to_apply((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyR�s"	
(cC`s�|dkr�|dkr+tjtjB}n>|dkrJtjtjB}n|dkritjtjB}n|tA}||@|B}n6|dkr�||B}n|dkr�|||@}n|S(NR�R&tgtoR�R�(R�tS_IRWXUtS_ISUIDtS_IRWXGtS_ISGIDtS_IRWXOtS_ISVTXt	PERM_BITS(R�toperatorR�tcurrent_modetmasktinverse_maskR�((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyR�>s

c`stj|j�}tj|j�}|t@dk}|p=|}tjd�}tj|�|tA}	|r�iitjd6d6itj	d6d6itj
d6d6}
n0iidd6d6idd6d6idd6d6}
ii|r�|	tj@ntjd6|r|	tj@ntjd6|r+|	tj@ntjd6tj
d	6dd
6|tj@d6|tj@d>d6|tj@d>d6d6i|r�|	tj@ntjd6|r�|	tj@ntjd6|r�|	tj	@ntj	d6tjd	6dd
6|tj@d?d6|tj@d6|tj@d>d6d6i|r3|	tj@ntjd6|rP|	tj@ntjd6|rm|	tj
@ntj
d6dd	6tjd
6|tj@d?d6|tj@d?d6|tj@d6d6�x+|
j�D]\}}�|j|�q�W��fd
�}
t|
|d�S(NiR(R&R�R�R�twtxRR"iic`s|��|BS(N((R�tperm(R�tuser_perms_to_modes(s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyt	or_reduce�s(R�R�R�tS_ISDIRtEXEC_PERM_BITSRtumaskRtS_IXUSRtS_IXGRPtS_IXOTHtS_IRUSRtS_IWUSRR�R�R�RtS_IRGRPtS_IWGRPR�tS_IROTHtS_IWOTHRR�tupdateRd(R�R�R�R�R�tis_directorythas_x_permissionstapply_X_permissionRt	rev_umasktX_permstkeyR�R((R�R
s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyR�Qs`




cC`s�|j|d|d||�}|j|d|d|||�}|j|d|d|||�}|j|d|d|||�}|j|d|d|||�}|S(NR�RqR�R�R�R�(R�R�R�R�R�(RPt	file_argsR�R�R�((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pytset_fs_attributes_if_different�scC`s|jotjj|�S(N(RRR�R[(RPt	file_path((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyR��scC`s|j||||�S(N(R (RPRR�R�R�((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyt%set_directory_attributes_if_different�scC`s|j||||�S(N(R (RPRR�R�R�((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyt set_file_attributes_if_different�sc	C`s�|jd|jdd��}|dkr.|St|dd�}tjj|�r�|j|�\}}||d<||d<ytj|�d}Wnt	k
r�t
|�}nXytj|�d}Wnt	k
r�t
|�}nX||d<||d	<tj
|�}d
tj|tj�|d<tjj|�rId|d
<nNtjj|�rhd|d
<n/tj|�jdkr�d|d
<n
d|d
<tr�|j�r�dj|j|��|d<n|tj|d<n|S(s�
        for results that are files, supplement the info about the file
        in the return path with stats about the file path.
        R�RoR�R�R�R�iR�R�s0%03oR�tlinktstatet	directoryithardtfileR�RqtsizeN(RrR�R1RR�R[R�R�tgetpwuidR�R
R�tgetgrgidR�R�R�tST_MODERstisdirtst_nlinkR{R�R�R�tST_SIZE(	RPR�R�RxR�R�R�R�R�((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyt
add_path_info�s>









cC`s�ytjtjd�Wn�tjk
rgtjtjd�dtjd<dtjd<dtjd<n9tk
r�}|jddt|�dt	j
��nXd	S(
s�
        Uses the locale module to test the currently set locale
        (per the LANG and LC_CTYPE environment settings)
        R�R
tLANGtLC_ALLtLC_MESSAGESRsLAn unknown error was encountered while attempting to validate the locale: %sR�N(tlocalet	setlocaleR2tErrorRR�R�RcR0R�R�(RPR((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyR5�s

R�cC`sF|dkr|j}n|dkr0|j}ng}t||d|�\}|_x6|D].\}}|jjd||||f�q[Wg}xS|j�D]E}	d||	j�kr�x&||	dD]}|j|�q�Wq�q�WxV|D]N}
|
d|j�kr�|jjid|
dd6|
j	d�d6�q�q�W|S(Ntalias_warningss(Both option %s and its alias %s are set.tdeprecated_aliasestnamesBAlias '%s' is deprecated. See the module docs for more informationRR(
R�RR�RVR.R*RtkeysR+Rr(RPtspectparamt
option_prefixR7t
alias_resultstoptiontaliasR8Rtdeprecation((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyR3�s&&
	cC`s�|dkr|j}n|dkr0|j}ny|jjt||��Wn:tk
r�}|jddt|�didd6�nX|j	j
t||��dS(NRsOFailure when processing no_log parameters. Module invocation will be hidden. %st
invocationsHIDDEN DUE TO FAILUREtmodule_args(R�RR�R�RRXR�RcR0R+textendRW(RPR;R<tte((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyR4sc	C`s*d|_t�}|dkr*|j}n|dkrB|j}n|dkrZ|j}nx<t|j��D](}|rm||krm|j|�qmqmWx�t	D]�}d|}||kr+|t
kr�t|t	|d|j||��nt|t	|d||�||jkre|j|=qeq�t
|t	|d�s�t|t	|dt	|d�q�q�W|r�d|jdjtt|���f}|jr�|ddj|j�7}n|d	djt|j���7}|jd
|�n|jr&|jr&|jdtd
d|j�ndS(
NtLOG_USERs_ansible_%siis*Unsupported parameters for (%s) module: %ss, s
 found in %s.s -> s! Supported parameters include: %sRtskippeds.remote module (%s) does not support check mode(t_syslog_facilityR�R�RR�R.R�R:R�RYRZtsetattrR~R�RR�tsortedR/RcRRt	exit_jsonR�(	RPRR;R<tlegal_inputstunsupported_parametersRSt	param_keyR((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyR6s:		

('(	#cC`s%|dkr|j}nt||�S(N(R�R�Rm(RPtcheckR<((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyt_count_terms>scC`s�|dkr|j}nyt||�WnUtk
r�}t|�}|jrm|ddj|j�7}n|jd|�nXdS(Ns found in %ss -> R(R�R�RgR�R0R/R�Rc(RPR;R<RR((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyR7Cs	cC`s�|dkrdS|dkr(|j}nyt||�WnUtk
r�}t|�}|jr}|ddj|j�7}n|jd|�nXdS(Ns found in %ss -> R(R�R�RkR�R0R/R�Rc(RPR;R<RR((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyRIOs	cC`s�|dkrdS|dkr(|j}nyt||�WnUtk
r�}t|�}|jr}|ddj|j�7}n|jd|�nXdS(Ns found in %ss -> R(R�R�RlR�R0R/R�Rc(RPR;R<RR((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyRH^s	cC`si|dkrdS|dkr(|j}nyt||�Wn)tk
rd}|jdt|��nXdS(NR(R�R�RiR�RcR0(RPR;R<R((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyRKlscC`s�|dkr|j}n|dkr0|j}nyt||�WnUtk
r�}t|�}|jr�|ddj|j�7}n|jd|�nXdS(Ns found in %ss -> R(	R�RR�RhR�R0R/R�Rc(RPR;R<RR((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyREws	cC`s�|dkrdS|dkr(|j}nyt||�WnUtk
r�}t|�}|jr}|ddj|j�7}n|jd|�nXdS(sA ensure that parameters which conditionally required are present Ns found in %ss -> R(R�R�RjR�R0R/R�Rc(RPR;R<RR((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyRJ�s	c
C`s|dkr|j}n|dkr0|j}nx�|j�D]�\}}|jdd�}|dkrmq=nt|t�r�t|ttf�r�||kr�t||t	�r`dj
g||D]}||kr�|^q��}|r�dj
g|D]}t|�^q��}	d||	|f}
|jrJ|
ddj
|j�7}
n|j
d|
�q�q�|||kr�d}||dkr�t|�}tj|�}t|�dkr�|\||<q�n||d	kr%|dkr�t|�}ntj|�}t|�dkr%|\||<q%n|||kr�dj
g|D]}t|�^qB�}	d
||	||f}
|jr�|
ddj
|j�7}
n|j
d|
�q�q�q�q=d||f}
|jr�|
ddj
|j�7}
n|j
d|
�q=WdS(
sR ensure all arguments have the requested values, and there are no stray arguments tchoicess, s<value of %s must be one or more of: %s. Got no match for: %ss found in %ss -> RR�iR�s'value of %s must be one of: %s, got: %ss<internal error: choices for argument %s are not iterable: %sN(R�RR�R�RrR�tSEQUENCETYPER^RbR�R�R0R/RcR6R|tintersectionR�R}(
RPR;R<RSRTRQtitemt	diff_listRtchoices_strRtlowered_choicestoverlap((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyRG�sR%2(	(		cC`st|||�S(N(Ry(RPR�tlocalstinclude_exceptions((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyRy�scC`s�itd6td6td6}|j|jt�}yt||�SWn�tk
r�d}|jdkr�|j�}tt|���q�|jdkr�dj|t	|�|�}|j
t|��t|dd�SnXdS(NterrorR_tignores4quote the entire value to ensure it does not change.s�The value {0!r} (type {0.__class__.__name__}) in a string field was converted to {1!r} (type string). If this does not look like what you expect, {2}R�R�(R�R�RrR-RxR�t
capitalizeR0tformatR2R_(RPR�toptstallow_conversiont
common_msgR((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyR9�s"

cC`s
t|�S(N(Rt(RPR�((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyR:�scC`s
t|�S(N(Ru(RPR�((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyR;�scC`s
t|�S(N(Rn(RPR�((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyR<�scC`s
t|�S(N(Rr(RPR�((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyR=�scC`s
t|�S(N(Rq(RPR�((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyR>�scC`s
t|�S(N(Rv(RPR�((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyR?�scC`s
t|�S(N(Rs(RPR�((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyRA�scC`s
t|�S(N(Rw(RPR�((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyR@�scC`s
t|�S(N(Rp(RPR�((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyRB�scC`s
t|�S(N(Ro(RPR�((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyRC�sc
C`s_|dkr|j}n|dkr0|j}nx(|j�D]\}}|jdd�}|dks�|dkr=|jdd�dkr=|jdd�}|jdt�r�|dk	r=|j|�dkr�i||<q�qq=n.|dks=||ks=||dkrq=n|jj|�t||t	�rG||g}n
||}x�t
|�D]�\}	}
t|
t	�s�|jdd	|�n||}|dkr�|d
|	7}n|d7}|j||
�|j
||
d|�}t|j��t|j��}
|j|j||
|
�|jsL|j|jd
d�|
�n|jdtd|d|
�|js|j||
�|j||
�|j||
�|j|jdd�|
�|j|jdd�|
�|j|jdd�|
�|j|jdd�|
�n|jdtd|d|
�|j||
|�q^W|jj�q=q=WdS(s& deal with options to create sub spec R�RR�telementsR�R�tapply_defaultsRs0value of %s must be of type dict or list of dicts[%d]t.R=RRR;R<RR R!R"N(R�RR�R�RrR�R/RR�RR�RcR2R3R�R:R6RRR7R8R�RERFRGRHRIRJRKRLR�(RPRR�RVRSRTtwantedR;RbR�R<t
new_prefixtoptions_aliasestoptions_legal_inputs((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyRL�sX0(


"		cC`s�t|�sc|dkr!d}ny|j|}Wq�tk
r_|jdd||f�q�Xn$|}t|dtt|���}||fS(NR
Rs6implementation error: unknown type %s requested for %sR	(tcallableR�RDR�RctgetattrR0R�(RPReRSttype_checker((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyt_get_wanted_type?s	
!c
C`s�|j||�\}}g}x�|D]�}y|j||��Wq%ttfk
r�}d|}	|jr�|	ddj|j�7}	n|	dt|�|t|�f7}	|jd|	�q%Xq%W|S(NsElements value for option %ss found in '%s's -> s6 is of type %s and we were unable to convert to %s: %sR(	RlRR�R�R/R�R�R0Rc(
RPReR<tvaluesRktwanted_nametvalidated_paramsR�RR((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyt_handle_elementsQs

	#cC`s�|dkr|j}n|dkr0|j}nx�|j�D]�\}}|jdd�}||krmq=n||}|dkr�q=n|j||�\}}y�||�||<|jdd�}	|	r_|dks�t||t�r?d||f}
|jr"|
ddj	|j�7}
n|
d7}
|j
d|
�n|j|	|||�||<nWq=tt
fk
r�}d	|t|�f}
|jr�|
ddj	|j�7}
n|
d
|t|�f7}
|j
d|
�q=Xq=WdS(s. ensure all arguments have the requested type R�RbR�sInvalid type %s for option '%s's found in '%s'.s -> s9, elements value check is supported only with 'list' typeRsargument %s is of type %ss( and we were unable to convert to %s: %sN(R�RR�R�RrRlR�R�R/R�RcRpR�R�R�R0(RPR;R<RSRTReR�RkRntwanted_elementsRR((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyRF_s:
 	
$	cC`s�|dkr|j}n|dkr0|j}nx�|j�D]u\}}|jdd�}||kr=|dk	sz|r=|jdt�r�|r�|jj|�n|||<q=q=WdS(NR�R�(R�RR�R�RrR�R�R�(RPRR;R<RSRTR�((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyR8�scC`s&|dkr|j}n|dkr0|j}nx�|j�D]�\}}|jdd�}|d}g}i}||kr=|dk	r=x0|dD]$}	t|	t�r�|	}q�|	}q�Wy|||�}
Wntk
r�q=qX|jdt�r|
r|j	j
|
�n|
||<q=q=WdS(NR�iiR�(N(R�RR�R�RrR�RR�R�R�R�(RPR;R<RSRTR�tfallback_strategyt
fallback_argstfallback_kwargsRTtfallback_value((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyR2�s*
	

cC`st�|_dS(s� read the input and set the params attribute.

        This method is for backwards compatibility.  The guts of the function
        were moved out in 2.1 so that custom modules could read the parameters.
        N(RR�(RP((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyR�scC`s^trZd|j}tt|jtj�}tjt|�d|�tjtj|�ndS(Ns
ansible-%si(	t
HAS_SYSLOGRRjtsyslogRHRFtopenlogR
tLOG_INFO(RPRtmoduletfacility((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyt_log_to_syslog�s

cC`s!|jr|jd|�ndS(Ns
[debug] %s(R$Rl(RPR((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pytdebug�s	c	C`s�|js�|dkr!t�}nd|j}t|t�rR|jdd�}nt|ttf�s�tdt	|���nt|t�r�t
|jdd�|j�}nt
||j�}tr�|}n|j
dd�}tr�dtjjt�fg}x1|D])}|j|j�t||�f�qWyutr�tt|jtj�d?}tjdd||fd	|t|��n#tjdd||ft|��Wq�tk
r�|j|�q�Xq�|j|�ndS(
Ns
ansible-%ssutf-8R�smsg should be a string (got %s)tMODULEitMESSAGEu%s %stSYSLOG_FACILITY(R�R�RRR�R^R�RbR�R�R�R�R\R�thas_journalRR�RRRtupperR
RvRjRwRHRFR.tsendR^R|(	RPRtlog_argsRztjournal_msgt
syslog_msgtjournal_argsR�R{((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyRl�s>	
!	
'
c
C`s�t�}x
|jD]�}|jj||�}|jj|i�}|jdd�}|dkr�tj|�r�d||<|jd|�q|j	|�r�d||<q|j|}t
|ttf�s�t
|�}n!t
|t�r�|jd�}nt||j�||<qWg|j�D](\}}dt|�t|�f^q#}	|	rmddj|	�}	nd	}	|j|	d
|�dS(s! log that ansible ran the module R�tNOT_LOGGING_PASSWORDs Module did not set no_log for %stNOT_LOGGING_PARAMETERsutf-8s%s=%ssInvoked with %sR�tInvokedR�N(RR�R�RrRR�tPASSWORD_MATCHtsearchR_R~R�RbR^R
R�R�R�R�R0R�Rl(
RPR�R<tcanontarg_optsR�t	param_valR�tvalR((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyRM�s*	


;cC`s�y<tj�}tj|tjtjB�s7t��n|SWn�tk
r�xu|jtjjd�t	j
�gD]K}y1tj|tjtjB�r�tj|�|SWqqtk
r�qqXqqWnXdS(Ns$HOME(
RtgetcwdtaccesstF_OKtR_OKR�RkR�RZRat
gettempdirtchdirR�(RPtcwd((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyRNs
+

cC`sLd}yt|||�}Wn)tk
rG}|jdt|��nX|S(sQ
        Find system executable in PATH.

        :param arg: The executable to find.
        :param required: if executable is not found and required is ``True``, fail_json
        :param opt_dirs: optional list of directories to search in addition to ``PATH``
        :returns: if found return full path; otherwise return None
        RN(R�RJR�RcR2(RPR�trequiredtopt_dirstbin_pathR((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyRJ,s
cC`sN|dkr|Syt|�SWn)tk
rI}|jdt|��nXdS(s!Convert the argument to a booleanRN(R�R~R�RcR0(RPR�R((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyR~>scC`s>yt|�SWn)tk
r9}|jdt|��nXdS(NR(R3tUnicodeErrorRcR2(RPR�R((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyR3HscC`s
tj|�S(N(R:R�(RPR�((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyt	from_jsonNscC`s&||jkr"|jj|�ndS(N(R#R(RPR�((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pytadd_cleanup_fileQscC`s%x|jD]}|j|�q
WdS(N(R#tcleanup(RPR�((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pytdo_cleanup_filesUscC`s�|j|�d|kr0i|jd6|d<nd|kr�t|dt�rtx3|dD]}|j|�qZWq�|j|d�n|jr�|j|d<nd|krmt|dt�rYx�|dD]�}t|t�rt|�dkr|j|dd|d�q�t|t	�rE|j|d	d|j
dd��q�|j|�q�Wqm|j|d�n|jr�|j|d<nt
||j�}td
|j|��dS(NRBRCtwarningstdeprecationsiiRiRs
%s(R0R�R�R�R_R*RRR�RORDRrR�R+R�R�R�R3(RPR�RR((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyt_return_formattedYs.
	!&	cK`s(|j�|j|�tjd�dS(s' return from the module, without error iN(R�R�R�R�(RPR�((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyRK|s

cK`s�d|krtd��nt|d<d|kr�tj�dr�|jsY|jdkr�tr�ddjtj	tj�d��|d<q�djtj	tj�d��|d<n|j
�|j|�tjd	�d
S(s/ return from the module, with an error message Rs<implementation error -- msg to explain the error is requiredtfailedR�iisIWARNING: The below traceback may *not* be related to the actual failure.
R�iN(
tAssertionErrorR�R�texc_infoR$R(R[R�R�t	format_tbR�R�R�(RPR�((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyRc�s
4*)

cC`sN|s
dSyt|j|�Wn)tk
rI}|jdt|��nXdS(NR(RfR�R�RcR0(RPtrequired_paramsR((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pytfail_on_missing_params�scC`s!t|dd�}tjj|�s(dStjj|�rQ|jdd|�nt|d�ri|}nKyt|�}Wn7t	k
r�|jdd||dj
t�f�nXd}ttjj|�d
�}|j
|�}x&|r|j|�|j
|�}q�W|j�|j�S(
sh Return hex digest of local file for a digest_method specified by name, or None if file is not present. R�R�Rs+attempted to take checksum of directory: %st	hexdigestsFCould not hash file '%s' with algorithm '%s'. Available algorithms: %ss, i@iR�Ni(R1RR�R[R�R-RcR�tAVAILABLE_HASH_ALGORITHMSR�R�R�RtR�RR�R�(RPtfilenamet	algorithmt
b_filenamet
digest_methodRtinfiletblock((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pytdigest_from_file�s(	
	

cC`s+dtkrtd��n|j|d�S(s� Return MD5 hex digest of local file using digest_from_file().

        Do not use this function unless you have no other choice for:
            1) Optional backwards compatibility
            2) Compatibility with a third party protocol

        This function will not work on systems complying with FIPS-140-2.

        Most uses of this function can use the module.sha1 function instead.
        R=s1MD5 not available.  Possibly running in FIPS mode(R�R�R�(RPR�((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyR=�scC`s|j|d�S(s@ Return SHA1 hex digest of local file using digest_from_file(). R>(R�(RPR�((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyR>�scC`s|j|d�S(sC Return SHA-256 hex digest of local file using digest_from_file(). R@(R�(RPR�((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyR@�scC`s�d}tjj|�r�tjdtjtj���}d|tj�|f}y|j||�Wq�tj	t
fk
r�}|jdd||t|�f�q�Xn|S(s[make a date-marked backup of the specified file, return True or False on success or failureR�s%Y-%m-%d@%H:%M:%S~s%s.%s.%sRs%Could not make backup of %s to %s: %s(
RR�R[R`tstrftimet	localtimetgetpidtpreserved_copyRgR6R^RcR0(RPtfnt
backupdesttextR((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pytbackup_local�s!*cC`s`tjj|�r\ytj|�Wq\tk
rX}tjjd|t|�f�q\XndS(Nscould not cleanup %s: %s(	RR�R[tunlinkR]R�tstderrtwriteR0(RPttmpfileR((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyR��s
cC`stj||�|j�rA|j|�}|j||t�nyhtj|�}tj|�}|r�|j|jks�|j	|j	kr�tj
||j|j	�nWn+tk
r�}|jtj
kr��q�nX|j|�}|jdd�}|j||t�dS(s=Copy a file with preserved ownership, permissions and contextR�R�N(Rgtcopy2R�R�R�R�RR�R�R�tchownR]R�R�R�RrR�R�(RPR�RoR�t	dest_statttmp_statRtcurrent_attribs((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyR��s
* 
cC`s�d}d}t|dd�}t|dd�}tjj|�ray�tj|�}tj||jt@�tj	||j
|j�ttd�rt|d�rytj
||j�Wqtk
r
}x@dD]1}	tt|	�r�|jtt|	�kr�Pq�q�W�qXnWn+tk
r?}|jtjkr@�q@nX|j�r|j|�}qn|j�r|j|�}ntjj|�}
ytj||�Wn�ttfk
r1}|jtjtjtjtjtjgkr|jdd||t|�fd	tj��q2tjj |�}tjj!|�}d}
d}z�y(t"j#d
dd|d
|�\}}WnQttfk
r�}dtjj |�t|�f}
nt$k
r�d}
nXWd|
r|r�|j%||�q|jd|
d	tj��nX|r2t|dd�}z�y�tj&|�yt'j(||�Wn!tk
rqt'j)||�nX|j�r�|j*||t+�nyYtj|�}|r�|j
|j
ks�|j|jkr�tj	||j
|j�nWn+tk
r}|jtjkr�qnXytj||�Wn|t'j,ttfk
r�}|rx|jtjkrx|j%||�q�|jdd|||t|�fd	tj��nXWngt'j,ttfk
r}|r�|j%||�q|jdd||t|�fd	tj��nXWd|j-|�Xq2nX|
r�tj.d�}tj.|�tj|t/|@�y#tj	|tj0�tj1��Wq�tk
r�q�Xn|j�r�|j*||t+�ndS(satomically move src to dest, copying attributes from dest, returns true on success
        it uses os.rename to ensure this as it is an atomic operation, rest of the function is
        to work around limitations, corner cases and ensure selinux context is saved if possibleR�R�tchflagstst_flagst
EOPNOTSUPPtENOTSUPRs$Could not replace file: %s to %s: %sR�RVs.ansible_tmpRWtsuffixsQThe destination directory (%s) is not writable by the current user. Error was: %ss�Failed creating tmp file for atomic move.  This usually happens when using Python3 less than Python3.5. Please use Python2.x or Python3.5 or greater.Ns=Unable to make %s into to %s, failed final rename from %s: %ss$Failed to replace file: %s to %s: %si(R�R�(2R�R1RR�R[R�R�R�RR�R�R�R�R�R�R]R�RjR�R�R�RvtrenameR^tEXDEVR�tETXTBSYtEBUSYRcR0R�R�R�RRatmkstempR�t_unsafe_writesR�RgtmoveR�R�R�R6R�RtDEFAULT_PERMtgeteuidtgetegid(RPR�RoR�R�R�tb_srctb_destRR�tcreatingt
b_dest_dirtb_suffixt	error_msgt
tmp_dest_namettmp_dest_fdtb_tmp_dest_nameR�R((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pytatomic_move
	s�
'
-2(%
 

* 
.7
#
cC`s�yjd}}z2t|d�}t|d�}tj||�Wd|rU|j�n|rh|j�nXWnNtjttfk
r�}|jdd||t	|�fdt
j��nXdS(NtwbR�Rs/Could not write data to file (%s) from (%s): %sR�(R�R�RgtcopyfileobjR�R6R]R^RcR0R�R�(RPR�Rotout_desttin_srcR((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyR��	s

"cC`sT|jsM|}tr6t|t�rTt|�}qTnt|t�rTt|�}nt|ttf�r{tj|�}ng}t	}x�d�|D�D]�}|r�t	}|j
d�q�ntj|�r|j
d�}|dkr|j
d|| �q�qt}nt||j�}|j
|�q�Wdjd�|D��|_n|jS(Ncs`s|]}t|�VqdS(N(R0(t.0R((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pys	<genexpr>�	ss********R�i����s%s=********R�cs`s|]}t|�VqdS(N(Re(R�R�((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pys	<genexpr>�	s(R,R[R�RbR1R^R2tshlexR�R�Rt
PASSWD_ARG_RER�tfindR�R�R�R�(RPR�t
to_clean_argst
clean_argst	is_passwdR�tsep_idx((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyt_clean_args�	s4	
	cC`s2tr.tjdkr.tjtjtj�ndS(Ntwin32(R[R�R�tsignaltSIGPIPEtSIG_DFL(RP((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyt_restore_signal_handlers�	ssutf-8R�c'C`sW
d'|_t|tttf�sFd}|jddd|d|�nt}|	r
t|t�r�djg|D]}t	t
|�dd�^qn�}nt	|dd�}|r�t	|dd�}|d	|g}q�|jd(krt	|jdd�d	|g}q�t}n�t|ttf�rjt
r=t	|dd�}ntrXt|dd�}ntj|�}n|r�g|D]<}|d'k	rwt	tjjtjj|��dd�^qw}n1g|D]$}|d'k	r�t	|dd�^q�}d'}|
r�t|
t�rAtr#t	|
dd�}
qAt
rAt	|
dd�}
qAnytj|
tj�}Wq�tjk
r�|jdd�q�Xnd
}d'}d'}i}xC|jj�D]2\}}tjj|d'�||<|tj|<q�W|r.xC|j�D]2\}}tjj|d'�||<|tj|<q�Wn|rftjd|d<d|tjdftjd<ndtjkr�tjdjd�}g|D],}|jd�r�|jd�r�|^q�}dj|�tjd<tjds�tjd=q�n|r	tj }nt!d|d|d|d|dtj dtj d|j"�}tr^|r^||d<nt
rw|rwt|d<ntj#�}|r4tjj$|�r4t	tjj%tjj|��dd�}||d<ytj&|�Wq4t't(fk
r0}|jd|j)dd|t*|�fdt+j,��q4Xnd'}|rRtj-|�}ny|j.r{|j/d|j0|��ntj1||�} |r�|| �nd }!d }"yt2j3�}#Wnt'k
r�t2j4�}#nX|#j5| j6t2j7�|#j5| j8t2j7�tj9d!kr�t:j:| j6j;�t:j<t:j:| j6j;�t:j=�tj>B�t:j:| j8j;�t:j<t:j:| j8j;�t:j=�tj>B�n|r�|s�|d"7}nt|t�r�t	|�}n| j?j@|�| j?jA�nxFtr5|#jBd#�}$x�|$D]~\}}%|jCjD�}&|&tEd �krL|#jF|jC�n|jC| j6krk|!|&7}!q|jC| j8kr|"|&7}"qqW|r�|jG|!�r�|r�|
r�t*|!d$|
d|�}!nd|!d%fSn|$s�|#jH�r| jI�d'k	rPq�|#jH�r�| jI�d'kr�| jJ�Pq�q�W| j6jA�| j8jA�|#jA�| jK}Wn�t't(fk
r�}|j/d&|j0|�t*|�f�|jd|j)dt*|�d|j0|��nvtLk
rH	}|j/d&|j0|�t*t+j,��f�|jdddt*|�dt+j,�d|j0|��nXx@|j�D]2\}}|d'kr{	tj|=qV	|tj|<qV	W|r�	tj-|�n|d
kr
|r
tM|"jN�|jO�}|jd|j0|�d|d|!d|"d|�ntj&|�|
d'k	rJ
|t*|!d$|
d|�t*|"d$|
d|�fS||!|"fS()s�
        Execute a command, returns rc, stdout, and stderr.

        :arg args: is the command to run
            * If args is a list, the command will be run with shell=False.
            * If args is a string and use_unsafe_shell=False it will split args to a list and run with shell=False
            * If args is a string and use_unsafe_shell=True it runs with shell=True.
        :kw check_rc: Whether to call fail_json in case of non zero RC.
            Default False
        :kw close_fds: See documentation for subprocess.Popen(). Default True
        :kw executable: See documentation for subprocess.Popen(). Default None
        :kw data: If given, information to write to the stdin of the command
        :kw binary_data: If False, append a newline to the data.  Default False
        :kw path_prefix: If given, additional path to find the command in.
            This adds to the PATH environment variable so helper commands in
            the same directory can also be found
        :kw cwd: If given, working directory to run the command inside
        :kw use_unsafe_shell: See `args` parameter.  Default False
        :kw prompt_regex: Regex string (not a compiled regex) which can be
            used to detect prompts in the stdout which would otherwise cause
            the execution to hang (especially if no input data is specified)
        :kw environ_update: dictionary to *update* os.environ with
        :kw umask: Umask to be used when running the command. Default None
        :kw encoding: Since we return native strings, on python3 we need to
            know the encoding to use to transform from bytes to text.  If you
            want to always get bytes back, use encoding=None.  The default is
            "utf-8".  This does not affect transformation of strings given as
            args.
        :kw errors: Since we return native strings, on python3 we need to
            transform stdout and stderr from bytes to text.  If the bytes are
            undecodable in the ``encoding`` specified, then use this error
            handler to deal with them.  The default is ``surrogate_or_strict``
            which means that the bytes will be decoded using the
            surrogateescape error handler if available (available on all
            python3 versions we support) otherwise a UnicodeError traceback
            will be raised.  This does not affect transformations of strings
            given as args.
        :kw expand_user_and_vars: When ``use_unsafe_shell=False`` this argument
            dictates whether ``~`` is expanded in paths and environment variables
            are expanded before running the command. When ``True`` a string such as
            ``$SHELL`` will be expanded regardless of escaping. When ``False`` and
            ``use_unsafe_shell=False`` no path or variable expansion will be done.
        :kw pass_fds: When running on Python 3 this argument
            dictates which file descriptors should be passed
            to an underlying ``Popen`` constructor. On Python 2, this will
            set ``close_fds`` to False.
        :kw before_communicate_callback: This function will be called
            after ``Popen`` object will be created
            but before communicating to the process.
            (``Popen`` object will be passed to callback as a first argument)
        :returns: A 3-tuple of return code (integer), stdout (native string),
            and stderr (native string).  On python2, stdout and stderr are both
            byte strings.  On python3, stdout and stderr are text strings converted
            according to the encoding and errors parameters.  If you want byte
            strings on python3, use encoding=None to turn decoding to text off.
        s5Argument 'args' to run_command must be list or stringR�itcmdRR�R�R�s-cs/bin/shR�s6invalid prompt regular expression given to run_commanditPATHs%s:%st
PYTHONPATHR�s/ansible_modlib.zips
/debug_dirRtshellt	close_fdsR�tstdoutR�t
preexec_fntpass_fdsR�sCould not open %s, %sR�sExecuting: R�tposixs
iR�sQA prompt was encountered while running a command, but no input data was specifieds#Error Executing CMD:%s Exception:%sN(Ns/bin/sh(PR�R,R�R�R^RbRcR�R�R1ReR'R�R[R\R2R�R�RR�RYRZtretcompilet	MULTILINER[R)R�R�Rrtendswitht
subprocesstPIPERR�R�R-tabspathR�R]R^R�R0R�R�RR$RlR�tPopenR/tDefaultSelectortPollSelectorRfR�t
EVENT_READR�R9tfcntltfilenotF_SETFLtF_GETFLt
O_NONBLOCKR�R�R�tselecttfileobjR�R]t
unregisterR�tget_maptpolltwaitt
returncodeR�R�trstripR�('RPR�tcheck_rcR�RR�tbinary_datatpath_prefixR�tuse_unsafe_shelltprompt_regextenviron_updateRR�R�texpand_user_and_varsR�tbefore_communicate_callbackRR�Rt	prompt_reR�tst_intold_env_valsRR�tpypathsR�tprev_dirRt	old_umaskR�R�R�tselectorteventsteventtb_chunk((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyR�	s.<	7!	L1!

		

*
(	

>A
	
&




&1,;
4
cC`sHtjjtjj|��}t|d�}|j|�|j�dS(NR(RR�RZRYR�R�R�(RPR�R
tfh((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pytappend_to_file�
s
cC`s
t|�S(N(R7(RPR)((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyR7�
scC`s
t||�S(N(R8(RPtnumbertisbits((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyR8�
scC`sUytj|d�}Wn8tk
rPy
tj}WqQtk
rLd}qQXnX|S(Nii(#(RR�RtPIPE_BUF(R�tbuffer_size((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pytget_buffer_size�
s


(dR	R
R�R�RUtpropertyRkR_RORzRuR�R�RvR�R�R�R�R�R�R�R�R�R�R�R�tclassmethodR�tstaticmethodR�R�R R�R"R#R0R5R3R4R6RPR7RIRHRKRERJRGRyR9R:R;R<R=R>R?RAR@RBRCRLRlRpRFR8R2RR|R}RlRMRNRJR~R3R�R�R�R�RKRcR�R�R=R>R@R�R�R�R�R�R�R�RR"R7tpretty_bytesR8RNR'(((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyR�s�		}'	
	4								-))T+	-E		(	
)3											A		%				4	!		
					#									#�		#	�		cC`stjjtjjt��S(N(RR�R�RtR(((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pytget_module_paths(�t
__future__RRRtFILE_ATTRIBUTESt__main__ReR�R�R�RR4RR�R�R�RR�RgR�R�R�R�RaR`R�ttypestcollectionsR+t	itertoolsR,R-RwR�RvtImportErrorR�tsystemdR.R�R{R|R�R�R�tansible.module_utils.compatR/t_textR0R1R2t+ansible.module_utils.common.text.convertersR3R4R�R5tjson_dict_bytes_to_unicodet+ansible.module_utils.common.text.formattersR6R7R8R9t(ansible.module_utils.common._json_compatR:RR�R^R�RR�thashlibt	attributeRjR<R�R=R�R�R�tshat/ansible.module_utils.common._collections_compatRCRDRERFRGRHRIt#ansible.module_utils.common.processRJt ansible.module_utils.common.fileRKRRLR
RMR�RNRORPt$ansible.module_utils.common.sys_infoRQRRRStansible.module_utils.pycompat24RTRUt&ansible.module_utils.common.parametersRVRWRXRYRZtansible.module_utils.sixR[R\R]R^R_R`RaRbtansible.module_utils.six.movesRcRdRet&ansible.module_utils.common.validationRfRgRhRiRjRkRlRmRnRoRpRqRrRsRtRuRvRwRxRyt"ansible.module_utils.common._utilsRzR�t)ansible.module_utils.parsing.convert_boolR{R|R}R~t	frozensetRRR�RR�timaptunicodet	NameErrort
basestringt
_literal_evalR�R�R1R�R�R�R�tversion_infot_PY3_MINt_PY2_MINt_PY_MINR�Rt
splitlinesR�R�R�R�R�R�R�RRR�tobjectRR,(((s>/usr/lib/python2.7/site-packages/ansible/module_utils/basic.pyt<module>sV








"	



4.(:
�"



													',				[	!	&,A	8��������l

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