%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3.9/site-packages/ansible/module_utils/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3.9/site-packages/ansible/module_utils/__pycache__/basic.cpython-39.pyc

a

�)g]R�@s
ddlmZmZmZeZdddddddd	d
ddd
ddddddddd�ZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlmZmZzddl Z dZ!Wne"�y.dZ!Yn0z(ddl#m$Z$m%Z&e'e$d��oTe&�(�Z)Wne"e*f�ytdZ)Yn0dZ+zddl,m-Z-dZ+Wne"�y�Yn0ed�Z.ddl,m/Z/dd l0m1Z1m2Z2m3Z3dd!l4m5Z5m6Z7m8Z9dd"l:m;Z;dd#l<m=Z=m>Z>m?Z?m@Z@zdd$lAmBZBWnBe"�yVZCz(eDd%�Ee1eC���e�Fd�WYdZC[Cn
dZC[C00eG�ZHz�ddlIZId&D]ZJeKeIeJd�ZLeL�rl�q��qleLdu�r�d'ZLeLD]ZMeKeIeM�eHeM<�q�zeI�N�Wn eO�y�eH�Pd(d�Yn0WnReQ�y6ddlRZRd)eRjRiZHzddlNZNeNjNeHd(<WneQ�y0Yn0Yn0dd*lSmTZTmUZUmVZVmWZWmXZXmYZYmZZZdd+l[m\Z\dd,l]m^Z^dd-l_m`ZambZcmdZemfZfmgZgmhZhdd.limjZjmkZkmlZldd/lmmnZnmoZodd0lpmqZqmrZrmsZsmtZtmuZumvZvdd1lwmxZxmyZymzZzdd2l{m|Z|m}Z}m~Z~mZm�Z�m�Z�m�Z�m�Z�dd3l�m�Z�m�Z�m�Z�dd4l�m�Z�m�Z�dd5l�m�Z�dd6l�m�Z�m�Z�m�Z�m�Z�dd7l�m�Z�m�Z�m�Z�m�Z�e�eTeWfZ�e��d8ej��Z�e�Z�ze�Wne��y�e�Z�Yn0ze�Wne��y�e�Z�Yn0eoZ�da�eGeGd9d:�eGd;d:�eGd;d:�eGd;d:�eGd;d:�eGd;d:�eGd;d:�eGd;d<gd=�eGd>deqd?gfd@�dA�	Z�e��dB�Z�e��dC�Z�e��dD�Z�e��dE�Z�ej�dFkZ�dGej�k�o�dHknZ�e��p�e�Z�e��s�eDdIdJ��ej������e�Fd�dKdL�Z�dMdN�Z�dOdP�Z�d[dQdR�Z�dSdT�Z�d\dUdV�Z�GdWdX�dXe��Z�dYdZ�Z�dS)]�)�absolute_import�division�print_functionZnoatime�append�
compressedZnocowZnodumpZdirsyncZextentsZ	encrypted�	blocksizeZ	immutableZindexedZ
journalledZinlineZzeroZsynchronousZnotailZ	blockrootZundeleteZ
compressedrawZcompresseddirty)�A�a�c�C�d�D�e�E�h�i�I�j�N�s�S�t�T�u�X�ZN)�chain�repeatTF)�journal�daemonZsendv)�selinux)�	selectors�)�	to_native�to_bytes�to_text)�jsonify�container_to_bytes�container_to_text)�ModuleArgumentSpecValidator)�lenient_lowercase�bytes_to_human�human_to_bytes�SIZE_RANGES)�jsonzJ
{{"msg": "Error: ansible requires the stdlib json: {0}", "failed": true}})Zavailable_algorithms�
algorithms)�md5�sha1Zsha224�sha256Zsha384Zsha512r0r1)�KeysView�Mapping�MutableMapping�Sequence�MutableSequence�Set�
MutableSet)�get_best_parsable_locale)�get_bin_path)�
_PERM_BITS�_EXEC_PERM_BITS�
_DEFAULT_PERM�
is_executable�format_attributes�get_flags_from_attributes)�get_distribution�get_distribution_version�get_platform_subclass)�
get_exception�literal_eval)�env_fallback�
remove_values�
sanitize_keys�DEFAULT_TYPE_VALIDATORS�	PASS_VARS�
PASS_BOOLS)�AnsibleFallbackNotFound�AnsibleValidationErrorMultiple�UnsupportedError)�PY2�PY3�b�binary_type�
integer_types�	iteritems�string_types�	text_type)�map�reduce�shlex_quote)�check_missing_parameters�	safe_eval)�get_all_subclasses)�BOOLEANS�BOOLEANS_FALSE�
BOOLEANS_TRUE�boolean)�	deprecate�get_deprecation_messages�get_warning_messages�warnzB^(?:.+[-_\s])?pass(?:[-_\s]?(?:word|phrase|wrd|wd)?)(?:[-_\s].+)?$�raw)�type�str�attr)rg�aliases�boolZANSIBLE_UNSAFE_WRITES)rg�default�fallback)	�mode�owner�group�seuser�serole�selevel�setype�
attributes�
unsafe_writesz^[-]{0,2}pass[-]?(word|wd)?z[+=-]z[^ugo]z[^rwxXstugo])��)��)rwz~
{"failed": true, "msg": "ansible-core requires a minimum of Python2 version 2.7 or Python3 version 3.5. Current version: %s"}�cCst��S)a+
    **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`.
    )�platform�system�r~r~�>/usr/lib/python3.9/site-packages/ansible/module_utils/basic.py�get_platforms	r�cOst|�}t||��|�S)zV**Deprecated**: Use ansible.module_utils.common.sys_info.get_platform_subclass instead)rD�super�__new__)�cls�args�kwargsZplatform_clsr~r~r�load_platform_subclasssr�cCstt|��S)zQ**Deprecated**: Use ansible.module_utils.common._utils.get_all_subclasses instead)�list�_get_all_subclasses)r�r~r~rr]$sr]c	CsLt|�}g}t|�}|}d}|�r.z|�dd|�}Wn,ty`|�d|d|��Y�q.Yn0d}|}|s�z|�dd|�}Wnty�d}Yn0z|�d|d|�}Wqjty�|dkr�|�d|d|��Yq�|}YqjYqj0qj|r|�d|||��|�dd�|�d|||d��|}qd	�|�}|�rHt||�}|S)
z; Remove strings that look like passwords from log messages r"�@rNz://�:rw�********r{)r#�len�rindex�
ValueError�insert�index�joinrH)�data�
no_log_values�outputZbeginZ
prev_begin�sep�endZsep_search_endr~r~r�heuristic_log_sanitize,sF



r�cCs
tdurt}n�ttj�dkrntj�tjd�rPttjdd�}|��}|�	�q�tjd}t
r�|jddd�}ntr~tj
��}ntj
j��}|azt�|�d��}Wn$ty�td�t�d�Yn0tr�t|�}z
|dWSt�ytd	�t�d�Yn0dS)
a1 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.
    Nr"�rb�utf-8�surrogateescape��errorsz�
{"msg": "Error: Module unable to decode valid JSON on stdin.  Unable to figure out what parameters were passed", "failed": true}ZANSIBLE_MODULE_ARGSz�
{"msg": "Error: Module unable to locate ANSIBLE_MODULE_ARGS in json data from stdin.  Unable to figure out what parameters were passed", "failed": true})�
_ANSIBLE_ARGSr��sys�argv�os�path�isfile�open�read�closerQ�encoderP�stdin�bufferr.�loads�decoder��print�exit�json_dict_unicode_to_bytes�KeyError)r��fd�paramsr~r~r�_load_paramsms4


r�cCsDt��}d||tjf}|r(|d|7}|r8|d|7}|d7}|S)NzDFailed to import the required Python library (%s) on %s's Python %s.z This is required %s.z See %s for more info.z� Please read the module documentation and install it 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|Znoder��
executable)Zlibrary�reason�url�hostname�msgr~r~r�missing_required_lib�sr�c@sLeZdZd�dd�Zedd��Zdd�Zd�d	d
�Zd�dd�Zd
d�Z	dd�Z
dd�Zd�dd�Zdd�Z
d�dd�Zdd�Zdd�Zdd �Zd�d!d"�Zd�d#d$�Zd�d%d&�Zd�d'd(�Zd�d)d*�Zd�d+d,�Zed-d.��Zed/d0��Zed1d2��Zd�d3d4�Zd5d6�Zd�d7d8�Zd�d9d:�Z d;d<�Z!d=d>�Z"d�d?d@�Z#d�dAdB�Z$dCdD�Z%dEdF�Z&dGdH�Z'd�dIdJ�Z(dKdL�Z)dMdN�Z*d�dOdP�Z+dQdR�Z,dSdT�Z-dUdV�Z.dWdX�Z/dYdZ�Z0d[d\�Z1d]d^�Z2d_d`�Z3d�dadb�Z4dcdd�Z5dedf�Z6dgdh�Z7didj�Z8dkdl�Z9dmdn�Z:dodp�Z;d�dqdr�Z<dsdt�Z=dudv�Z>dwdx�Z?d�d{d|�Z@d}d~�ZAdd��ZBeBZCd�d�d��ZDeEZEed�d���ZFdS)��
AnsibleModuleFNcCstj�t�|_||_||_d|_||_||_	||_
||_||_|	|_
|
|_g|_d|_d|_d|_d|_d|_d|_i|_i|_d|_i|_g|_t�|_d|_|r�t��D]\}}||jvr�||j|<q�t �|_!|�"�|�#�|�$�t%|j|j
|j|j|j
|j�|_&|j&�'|j(�|_)|j(�*|j)j+�|j!�*|j)j,�|j�*|j)j-�z|j)j.d}
Wnt/�yrd}
Yn0|
�r�|j)j.j0}t1|
t2��r�dj3|jd|d�}|j4|d	�|j�r�|j�s�|j5d
d|jd�t6|_7|j	�s�|�8�d|_9d|_:d|_;|�<�dS)
a7
        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.
        FN�LOG_USERrr{z1Unsupported parameters for ({name}) {kind}: {msg}�module)�name�kindr��r�Tz.remote module (%s) does not support check mode)Zskippedr�)=r�r��basename�__file__�_name�
argument_spec�supports_check_mode�
check_mode�
bypass_checks�no_log�mutually_exclusive�required_together�required_one_of�required_if�required_by�
cleanup_files�_debugZ_diffZ_socket_path�_shell�_syslog_facility�
_verbosity�run_command_environ_update�_cleanZ_string_conversion_actionrjZ
_legal_inputsr�Z_options_context�_tmpdir�FILE_COMMON_ARGUMENTS�items�setr��
_check_localer��_set_internal_propertiesr)Z	validatorZvalidater�Zvalidation_result�updateZvalidated_parametersZ_no_log_values�_aliasesr��
IndexErrorr��
isinstancerO�format�	fail_json�	exit_jsonrJZ _CHECK_ARGUMENT_TYPES_DISPATCHER�_log_invocation�_selinux_enabled�_selinux_mls_enabled�_selinux_initial_context�_set_cwd)�selfr�r�r�r�r�r�Zadd_file_common_argsr�r�r��k�v�errorr�r~r~r�__init__�s|

�

zAnsibleModule.__init__c
Cs.|jdu�r(d}|jdur0tj�tj�|j��}|dur�tj�|�s�ztj|dd�WnBtt	fy�}z&|�
d|t|�f�d}WYd}~nd}~00|�
d|�dt��}zt
j||d�}WnDtt	f�y
}z&|jd||t|�fd�WYd}~n
d}~00|j�s"t�tj|�||_|jS)	Ni�)rnzCUnable to use %s as temporary directory, failing back to system: %sz�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 manuallyzansible-moduletmp-%s-)�prefix�dirzDFailed to create remote module tmp path at dir %s with prefix %s: %sr�)r�Z_remote_tmpr�r��
expanduser�
expandvars�exists�makedirs�OSError�IOErrorrer#�time�tempfileZmkdtempr�Z_keep_remote_files�atexit�register�shutil�rmtree)r�ZbasedirrZbasefile�tmpdirr~r~rr�s8

����zAnsibleModule.tmpdircCst|�|�d|�dS)Nz[WARNING] %s)re�log)r�Zwarningr~r~rre@szAnsibleModule.warncCsZ|dur|durtd��t||||d�|durD|�d||f�n|�d||f�dS)Nz=implementation error -- version and date must not both be set��version�date�collection_namezEPRECATION WARNING] %s %s)�AssertionErrorrbr�)r�r�r�r�r�r~r~rrbDszAnsibleModule.deprecatecCsH|dur|�d|�dd��}|dur(iStj�tj�|��}t|dd�}|�dd�rttj�|�rttj�|�}t|�}|�dd�}|�d	d�}|�d
d�}|�dd�}|�dd�}|�d
d�}	|�dd�}
|||	g}|�	�r�|�
|
�|�|�}tt
|��D]$}
|
dur�||
dkr�||
||
<q�|�dd�}t|||||||	|
||d�
S)a
        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.

        Allows to overwrite the path/dest module argument by providing path.
        Nr��dest�surrogate_or_strictr��followFrnrorprqrrrtrsZ_defaultru)
r�rnrorprqrrrtrs�	secontextru)�getr�r�r�r�r$�islink�realpathr#�selinux_mls_enabledr�selinux_default_context�ranger��dict)r�r�r��b_pathrnrorprqrrrtrsrZdefault_secontextrrur~r~r�load_file_common_argumentsOs:	


�z(AnsibleModule.load_file_common_argumentscCs"|jdurtot��dk|_|jS�Nr")r��HAVE_SELINUXr Zis_selinux_mls_enabled�r�r~r~rr�s
z!AnsibleModule.selinux_mls_enabledcCs"|jdurtot��dk|_|jSr)r�rr Zis_selinux_enabledr
r~r~r�selinux_enabled�s
zAnsibleModule.selinux_enabledcCs.|jdur(gd�|_|��r(|j�d�|jS)N)NNN)r�rrr
r~r~r�selinux_initial_context�s


z%AnsibleModule.selinux_initial_contextrcCsh|��}|��s|Szt�t|dd�|�}WntyB|YS0|ddkrT|S|d�dd�}|S)Nr�r�r���r"r�rw)rrr Zmatchpathconr#r��split)r�r�rn�context�retr~r~rr�s
z%AnsibleModule.selinux_default_contextc
Cs�|��}|��s|Szt�t|dd��}WnRty|}z:|jtjkrZ|j|d|d�n|j|dd�WYd}~n
d}~00|ddkr�|S|d�	d	d
�}|S)Nr�r�zpath %s does not exist�r�r�z"failed to retrieve selinux contextrrr"r�rw)
rrr Zlgetfilecon_rawr#r��errno�ENOENTr�r)r�r�rrrr~r~r�selinux_context�s$zAnsibleModule.selinux_contextTcCsBt|dd�}|r$tj�tj�|��}t�|�}|j}|j}||fS�Nr�r�)r$r�r�r�r��lstat�st_uid�st_gid)r�r��expandr	�st�uid�gidr~r~r�user_and_group�s
zAnsibleModule.user_and_groupcCsJtj�ttj�tj�|��dd��}tj�|�s>tj�|�}q$t|dd�S)z�
            Takes a path and returns it's mount point

        :param path: a string type with a filesystem path
        :returns: the path to the mount point as a text type
        r�r�)	r�r�rr$r�r��ismount�dirnamer%)r�r�r	r~r~r�find_mount_point�s$zAnsibleModule.find_mount_pointc
Cs�ztdd�}|��}|��Wnty2YdS0|�|�}|D]X}|�dd�\}}}}	}
t|�t|�krB|jD]&}||vrr|�|�}d|fSqrqBdS)z�
        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).
        z/proc/mounts�r)FN� �T)	r��	readlinesr��	Exceptionr#rr$Z_selinux_special_fsr)
r�r��fZ
mount_dataZpath_mount_point�lineZdeviceZmount_pointZfstype�options�restZfsZspecial_contextr~r~r�is_special_selinux_path�s



z%AnsibleModule.is_special_selinux_pathcCs$|��s|S|�|�}|�||d�S)NF)rr�set_context_if_different)r�r��changedrr~r~r�set_default_selinux_context�s
z)AnsibleModule.set_default_selinux_contextc
Csx|��s|S|�|�rdS|�|�}t|�}|�|�\}}|rD|}n`tt|��D]R}	t|�|	krP||	dur�||	||	kr�||	||	<qP||	durP||	||	<qP||k�rt|dur�d|vr�i|d<||dd<d|vr�i|d<||dd<z&|jr�WdSt�	t
|�d�|��}
WnBt�yV}z(|j
|dt
|�|||d�WYd}~n
d}~00|
dk�rp|j
|d	d
�d}|S)NT�beforer�afterr�zinvalid selinux context: %s)r�r��new_context�cur_contextZ	input_wasrzset selinux context failedr)r�check_file_absent_if_check_moderr�r-rr�r�r Zlsetfileconr#r�r�r�)r�r�rr/�diffr4r3Z
is_special_seZ
sp_contextr�rcrr~r~rr.�sF


�
z&AnsibleModule.set_context_if_differentcCsf|dur|St|dd�}|r0tj�tj�|��}|�|�r>dS|�||�\}}zt|�}	WnPty�zt	�
|�j}	Wn,ty�t
|�}|j|d|d�Yn0Yn0||	k�rb|dur�d|vr�i|d<||dd<d|vr�i|d<|	|dd<|j�rdSzt�||	d	�WnHttf�y\}
z*t
|�}|j|d
t
|
�d�WYd}
~
n
d}
~
00d}|S)Nr�r�Tz'chown failed: failed to look up user %srr1ror2rzchown failed: %s)r$r�r�r�r�r5r �intr��pwd�getpwnam�pw_uidr�r%r�r��lchownr�r�)r�r�ror/r6rr	�orig_uid�orig_gidrrr~r~r�set_owner_if_differentsB

,z$AnsibleModule.set_owner_if_differentc
CsH|dur|St|dd�}|r0tj�tj�|��}|�|�r>dS|�||�\}}zt|�}	WnPty�zt	�
|�j}	Wn,ty�t
|�}|j|d|d�Yn0Yn0||	k�rD|dur�d|vr�i|d<||dd<d|vr�i|d<|	|dd<|j�rdSzt�|d	|	�Wn*t�y>t
|�}|j|d
d�Yn0d}|S)Nr�r�Tz(chgrp failed: failed to look up group %srr1rpr2rzchgrp failed)r$r�r�r�r�r5r r8r��grp�getgrnam�gr_gidr�r%r�r�r<r�)
r�r�rpr/r6rr	r=r>rr~r~r�set_group_if_differentHsB

z$AnsibleModule.set_group_if_differentc

Cs�|dur|St|dd�}|r0tj�tj�|��}|�|�r>dSt�|�}t|t�s�zt|d�}Wn�t	y�z|�
||�}Wn@t	y�}z(t|�}|j|dt
|�d�WYd}~n
d}~00|t�|�kr�t|�}|j|d|d�Yn0t�|j�}	|	|k�r�|du�rPd|v�ri|d<d	|	|dd
<d|v�r@i|d<d	||dd
<|j�r\dSz|ttd��rxt�||�n^tj�|��s�t�||�nBt�|�}
t�||�t�|�}|
j|jk�r�t�|t�|
j��Wn�t�y>}zLtj�|��r|jtjtjtjfv�rn|jtjtjfv�r(n�WYd}~nPd}~0t	�y�}z.t|�}|j|d
t
|�t��d�WYd}~n
d}~00t�|�}t�|j�}||	k�r�d}|S)Nr�r�T�z&mode must be in octal or symbolic form)r�r��detailsz6Invalid mode supplied, only permission info is allowedr1�0%03ornr2�lchmodzchmod failed�r�r�rE�	exception)r$r�r�r�r�r5rr�r8r(�_symbolic_mode_to_octalr%r�r#�stat�S_IMODE�st_moder��hasattrrGr�chmodr�r�EACCES�EPERMZEROFSr�ELOOP�	traceback�
format_exc)
r�r�rnr/r6rr	�	path_statr�	prev_modeZunderlying_statZnew_underlying_stat�new_moder~r~r�set_mode_if_differentqs�


�





��

z#AnsibleModule.set_mode_if_differentc
Cs�|dur|St|dd�}|r0tj�tj�|��}|�|�r>dS|j|dd�}d}|�d�rn|d}|d	d�}|�d
d�|ks�|dk�r~|�	d
�}	|	�r~|	d||f|g}	d}|dur�d|vr�i|d<|�d
�|dd<d|vr�i|d<d||f|dd<|j
�s~z4|�|	�\}
}}|
dk�s&|�r6td||��WnDt�y|}
z*|j
t|�dt|
�t��d�WYd}
~
n
d}
~
00|S)Nr�r�TF��include_version�=)�-�+rr"�
attr_flagsr{r\Zchattrz%s%sr1rur2z"Error while setting attributes: %sz
chattr failedrH)r$r�r�r�r�r5�get_file_attributes�
startswithrr;r��run_commandr(r�r%r#rSrT)r�r�rur/r6rr	�existingZattr_mod�attrcmdr7�out�errrr~r~r�set_attributes_if_different�sD


�z)AnsibleModule.set_attributes_if_differentcCs�i}|�dd�}|r�|rdnd}|||g}zh|�|�\}}}|dkr�|��}	d}
|rhd}
|	d��|d<|	|
�dd	���|d
<t|d
�|d<Wnty�Yn0|S)NZlsattrFz-vdz-drr"r�r\r{r^ru)r;rar�strip�replacer@r()r�r�rZr�rc�flagsr7rdre�resZattr_flags_idxr~r~rr_�s$
z!AnsibleModule.get_file_attributesc
	Cs�t�|j�}|�d�D]�}t�|�}t�|�}|�d�}|dk}|dksP|dkrTd}t�|�rjt	d|��t
|�D]L\}	}
t�|
�r�t	d|��|D](}|�|||
|�}|�
|||	||�}q�qrq|S)z�
        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"
        �,rr{r	Zugoz$bad symbolic permission for mode: %s)rKrLrMr�MODE_OPERATOR_RE�findall�pop�USERS_RE�matchr��	enumerate�PERMS_RE�#_get_octal_mode_from_symbolic_perms�_apply_operation_to_mode)
r�rUZ
symbolic_moderWrnZpermlistZopersZusers�	use_umask�idx�perms�user�
mode_to_applyr~r~rrJs"




z%AnsibleModule._symbolic_mode_to_octalcCs�|dkr^|dkrtjtjB}n*|dkr4tjtjB}n|dkrHtjtjB}|tA}||@|B}n&|dkrp||B}n|dkr�|||@}|S)Nr[r�g�or]r\)rK�S_IRWXU�S_ISUID�S_IRWXG�S_ISGID�S_IRWXO�S_ISVTX�	PERM_BITS)rx�operatorryZcurrent_mode�maskZinverse_maskrWr~r~rrt2s
z&AnsibleModule._apply_operation_to_modecs�t�|j�}t�|j�}|t@dk}|p*|}t�d�}t�|�|tA}	|rldtjidtj	idtj
id�}
nddiddiddid�}
|r�|	tj@ntj|r�|	tj@ntj|r�|	tj@ntjtj
d|tj@|tj@d>|tj@d>d�|r�|	tj@ntj|�r|	tj@ntj|�r|	tj	@ntj	tjd|tj@d?|tj@|tj@d>d�|�rX|	tj@ntj|�rl|	tj@ntj|�r�|	tj
@ntj
dtj|tj@d?|tj@d?|tj@d�d��|
��D]\}}�|�|��q���fdd�}
t|
|d�S)	Nrr)rrzr{rw�)r$�w�xrrrrzr{cs|��|BS�Nr~)rnZperm�rxZuser_perms_to_modesr~r�	or_reduce�szDAnsibleModule._get_octal_mode_from_symbolic_perms.<locals>.or_reduce)rKrLrM�S_ISDIR�EXEC_PERM_BITSr��umaskr��S_IXUSR�S_IXGRP�S_IXOTH�S_IRUSR�S_IWUSRr}r|r~r��S_IRGRP�S_IWGRPr�S_IROTH�S_IWOTHr�r�r�rY)rUrxrwrurVZis_directoryZhas_x_permissionsZapply_X_permissionr�Z	rev_umaskZX_perms�key�valuer�r~r�rrsEs`

���
�
��z1AnsibleModule._get_octal_mode_from_symbolic_permscCs�|�|d|d||�}|�|d|d|||�}|�|d|d|||�}|�|d|d|||�}|�|d|d|||�}|S)Nr�rrorprnru)r.r?rCrXrf�r�Z	file_argsr/r6rr~r~r�set_fs_attributes_if_different�s �����z,AnsibleModule.set_fs_attributes_if_differentcCs|jotj�|�Sr�)r�r�r�r�)r�Z	file_pathr~r~rr5�sz-AnsibleModule.check_file_absent_if_check_modecCs|�||||�Sr��r�r�r~r~r�%set_directory_attributes_if_different�sz3AnsibleModule.set_directory_attributes_if_differentcCs|�||||�Sr�r�r�r~r~r� set_file_attributes_if_different�sz.AnsibleModule.set_file_attributes_if_differentc	Csh|�d|�dd��}|dur |St|dd�}tj�|��rd|�|�\}}||d<||d<zt�|�d}Wnty�t	|�}Yn0zt
�|�d}Wnty�t	|�}Yn0||d	<||d
<t�|�}dt
�|t
j�|d<tj�|�r�d
|d<n<tj�|��rd|d<n$t�
|�jdk�r0d|d<nd|d<|���rVd�|�|��|d<|t
j|d<|S)z�
        for results that are files, supplement the info about the file
        in the return path with stats about the file path.
        r�r�Nr�r�rrrrorprFrn�link�stateZ	directoryr"Zhard�filer�r�size)rr$r�r�r�r r9�getpwuidr�rhr@�getgrgidrrKrL�ST_MODEr�isdir�st_nlinkrr�r�ST_SIZE)	r�r�r�r	rrrxrprr~r~r�
add_path_info�s>




zAnsibleModule.add_path_infoc
Cs�zt�tjd�Wn�tjyZt|�}t�tj|�|tjd<|tjd<|tjd<Yn>ty�}z&|jdt	|�t
��d�WYd}~n
d}~00dS)z�
        Uses the locale module to test the currently set locale
        (per the LANG and LC_CTYPE environment settings)
        r{�LANG�LC_ALL�LC_MESSAGESzLAn unknown error was encountered while attempting to validate the locale: %s�r�rIN)�locale�	setlocaler��Errorr:r��environr(r�r#rSrT)r�Zbest_localerr~r~rr��s

��zAnsibleModule._check_localecCs�|dur|j}|dur|j}tD]�}d|}||vr�|tvr\t|t|d|�||��nt|t|d||�||jvr�|j|=q t|t|d�s t|t|dt|d�q dS)Nz_ansible_%srr")r�r�rKrL�setattrrarN)r�r�Zmodule_parametersr�Z	param_keyr~r~rr��s 

z&AnsibleModule._set_internal_propertiescCst|||�Sr�)r\)r�r��localsZinclude_exceptionsr~r~rr\�szAnsibleModule.safe_evalcCst�|_dS)z� 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)r�r�r
r~r~rr�szAnsibleModule._load_paramsc
Cs�tr�z>d|j}tt|jtj�}t�t|�d|�t�tj|�Wn@t	y�}z(|j
dt|�t�
�|d�WYd}~n
d}~00dS)N�
ansible-%srz�Failed to log to syslog (%s). To proceed anyway, disable syslog logging by setting no_target_syslog to True in your Ansible config.)r�rIZ
msg_to_log)�
HAS_SYSLOGr��getattr�syslogr�r�ZopenlogrhZLOG_INFO�	TypeErrorr�r#rSrT)r�r�r��facilityrr~r~r�_log_to_syslog	s
��zAnsibleModule._log_to_syslogcCs|jr|�d|�dS)Nz
[debug] %s)r�r�)r�r�r~r~r�debugszAnsibleModule.debugcCs~|j�sz|durt�}d|j}t|t�r6|�dd�}t|ttf�sTtdt|���t|t�rtt	|�dd�|j
�}nt	||j
�}tr�|}n|�dd�}t
�rpdtj�t�fg}|D]8}|��t||�}}	|dvr�d|}|�||	f�q�zbt�r,tt|jtj�d?}
tjfd	||f|
d
�t|���n tjfdd	||fit|���Wnt�yl|�|�Yn0n
|�|�dS)Nr�r�rhzmsg should be a string (got %s)ZMODULE)	ZPRIORITY�MESSAGEZ
MESSAGE_IDZ	CODE_FILEZ	CODE_LINEZ	CODE_FUNC�SYSLOG_FACILITYZSYSLOG_IDENTIFIERZ
SYSLOG_PIDz_%srwz%s %s)r�r�r�)r�rr�r�rSr�rWr�rgrHr�rQr��has_journalr�r�r�r��upperrhrr�r�r�r�r�r�sendr�r�)r�r��log_argsr�Zjournal_msgZ
syslog_msgZjournal_args�argr�r�r�r~r~rr�sP


�����
zAnsibleModule.logcCs�t�}|jD]�}|j�||�}|j�|i�}|�dd�}|durbt�|�rbd||<|�d|�q|�|�rvd||<q|j|}t	|t
tf�s�t|�}nt	|t
�r�|�
d�}t||j�||<qdd�|��D�}|r�d	d
�|�}nd}|j||d�dS)
z! log that ansible ran the module r�NZNOT_LOGGING_PASSWORDz Module did not set no_log for %sZNOT_LOGGING_PARAMETERr�cSs$g|]\}}dt|�t|�f�qS)z%s=%s�r#)�.0r��valr~r~r�
<listcomp>s�z1AnsibleModule._log_invocation.<locals>.<listcomp>zInvoked with %sr%ZInvoked)r�)rr�rjrr��PASSWORD_MATCH�searchrerar�rWrSrhr�r�r�r�r�r�)r�r�ZparamZcanonZarg_optsr�Z	param_valr�r~r~rr�Zs*






zAnsibleModule._log_invocationcCs�z(t��}t�|tjtjB�s$t��|WSty�|jtj�d�t	�
�fD]H}z0t�|tjtjB�r�t�|�|WYSWqNty�YqN0qNYn0dS)Nz$HOME)r��getcwd�access�F_OK�R_OKr(r�r�r�r�Z
gettempdir�chdir)r��cwdr~r~rr�{s
zAnsibleModule._set_cwdc
Csdd}zt||d�}WnJty^}z2|r:|jt|�d�n|WYd}~SWYd}~n
d}~00|S)aQ
        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
        N)r��opt_dirsr�)r;r�r�r%)r�r��requiredr�Zbin_pathrr~r~rr;�s
&zAnsibleModule.get_bin_pathc
CsP|dur|Sz
t|�WStyJ}z|jt|�d�WYd}~n
d}~00dS)z!Convert the argument to a booleanNr�)rar�r�r#)r�r�rr~r~rra�s
zAnsibleModule.booleanc
CsDz
t|�WSty>}z|jt|�d�WYd}~n
d}~00dS�Nr�)r&�UnicodeErrorr�r%)r�r�rr~r~rr&�s
zAnsibleModule.jsonifycCs
t�|�Sr�)r.r�)r�r�r~r~r�	from_json�szAnsibleModule.from_jsoncCs||jvr|j�|�dSr�)r�r�r�r�r~r~r�add_cleanup_file�s
zAnsibleModule.add_cleanup_filecCs|jD]}|�|�qdSr�)r��cleanupr�r~r~r�do_cleanup_files�s
zAnsibleModule.do_cleanup_filescCsJ|�|�d|vr d|ji|d<d|vr^t|dt�rP|dD]}|�|�q>n|�|d�t�}|rp||d<d|v�rt|dt��r|dD]p}t|t�r�t|�dkr�|j|d|dd�q�t|t	�r�|j|d	|�
d
�|�
d�|�
d�d
�q�|�|�q�n|�|d�t�}|�r(||d<t||j
�}td|�|��dS)NZ
invocationZmodule_args�warnings�deprecationsryrr")r�r�r�r�r�r�z
%s)r�r�r�r�rerd�SEQUENCETYPEr�rbr4rrcrHr�r�r&)r�r�r�r�rr�r~r~r�_return_formatted�s6


�zAnsibleModule._return_formattedcKs |��|�|�t�d�dS)z' return from the module, without error rN)r�r�r�r�)r�r�r~r~rr��s
zAnsibleModule.exit_jsoncKs�d|d<||d<d|vrvt��drv|js4|jdkrvtrZdd�t�t��d��|d<nd�t�t��d��|d<|��|�	|�t�
d	�d
S)z/ return from the module, with an error message TZfailedr�rIryrwzIWARNING: The below traceback may *not* be related to the actual failure.
r{r"N)r��exc_infor�r�rPr�rS�	format_tbr�r�r�)r�r�r�r~r~rr��s$�

zAnsibleModule.fail_jsonc
CsR|sdSzt|j|�Wn4tyL}z|jt|�d�WYd}~n
d}~00dSr�)r[r�r�r�r#)r�Zrequired_paramsrr~r~r�fail_on_missing_paramssz$AnsibleModule.fail_on_missing_paramsc
Cs�t|dd�}tj�|�sdStj�|�r8|jd|d�t|d�rH|}n>zt|�}Wn.ty�|jd||d�	t�fd�Yn0d	}t
tj�|�d
�}|�|�}|r�|�
|�|�|�}q�|��|��S)zh Return hex digest of local file for a digest_method specified by name, or None if file is not present. r�r�Nz+attempted to take checksum of directory: %sr��	hexdigestzFCould not hash file '%s' with algorithm '%s'. Available algorithms: %sz, ir�)r$r�r�r�r�r�rN�AVAILABLE_HASH_ALGORITHMSr�r�r�rr�r�r�r�)r��filename�	algorithmZ
b_filenameZ
digest_methodrZinfile�blockr~r~r�digest_from_files*
�

zAnsibleModule.digest_from_filecCsdtvrtd��|�|d�S)a� 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.
        r0z1MD5 not available.  Possibly running in FIPS mode)r�r�r��r�r�r~r~rr0$szAnsibleModule.md5cCs|�|d�S)z@ Return SHA1 hex digest of local file using digest_from_file(). r1�r�r�r~r~rr13szAnsibleModule.sha1cCs|�|d�S)zC Return SHA-256 hex digest of local file using digest_from_file(). r2r�r�r~r~rr27szAnsibleModule.sha256c
Cs�d}tj�|�r�t�dt�t����}d|t��|f}z|�||�WnDtj	t
fy�}z&|jd||t|�fd�WYd}~n
d}~00|S)z[make a date-marked backup of the specified file, return True or False on success or failurer{z%Y-%m-%d@%H:%M:%S~z%s.%s.%sz%Could not make backup of %s to %s: %sr�N)
r�r�r�r��strftime�	localtime�getpid�preserved_copyr�r�r�r�r#)r��fnZ
backupdest�extrr~r~r�backup_local;s0zAnsibleModule.backup_localc
Cs\tj�|�rXzt�|�Wn<tyV}z$tj�d|t|�f�WYd}~n
d}~00dS)Nzcould not cleanup %s: %s)	r�r�r��unlinkr�r��stderr�writer#)r�Ztmpfilerr~r~rr�Ks
zAnsibleModule.cleanupc
Cs�t�||�|��r,|�|�}|�||d�zFt�|�}t�|�}|rp|j|jks^|j|jkrpt�	||j|j�Wn2t
y�}z|jtjkr��WYd}~n
d}~00|j
|dd�}|�dd�}|�||d�dS)z=Copy a file with preserved ownership, permissions and contextFNrYr^r{T)r��copy2rrr.r�rKrr�chownr�rrQr_rrf)r��srcr�r�	dest_stat�tmp_statrZcurrent_attribsr~r~rr�Rs



zAnsibleModule.preserved_copyc
Csd}d}t|dd�}t|dd�}tj�|��r"z�t�|�}t�||jt@�t�||j	|j
�ttd�r�t|d�r�zt�||j
�WnNty�}z6dD]"}	tt|	�r�|jtt|	�kr�q�q��WYd}~n
d}~00Wn4t�y
}z|jtjkr��WYd}~n
d}~00|���r6|�|�}n|���r6|�|�}tj�|�}
zt�||�W�nNttf�y�}�z.|jtjtjtjtjtjfv�r�|jd||t|�ft��d��n�tj�|�}tj� |�}d}
d}z�zt!j"d	||d
�\}}WnXttf�y.}z$dtj�|�t|�f}
WYd}~n d}~0t#�yDd}
Yn0W|
�r�|�rb|�$||�n|j|
t��d�n.|
�r�|�r�|�$||�n|j|
t��d�0|�r�t|dd�}�zʐzVt�%|�zt&�'||�Wn t�y�t&�(||�Yn0|���r|�)||d
�zBt�|�}|�rR|j	|j	k�s@|j
|j
k�rRt�||j	|j
�Wn6t�y�}z|jtjk�rv�WYd}~n
d}~00zt�||�Wnrt&j*ttf�y}zP|�r�|jtjk�r�|�$||�n"|jd|||t|�ft��d�WYd}~n
d}~00Wnbt&j*ttf�yt}z@|�r@|�$||�n |jd||t|�ft��d�WYd}~n
d}~00W|�+|�n|�+|�0WYd}~n
d}~00|
�rt�,d�}t�,|�t�|t-|@�zt�|t�.�t�/��Wnt�yYn0|���r|�)||d
�dS)aatomically 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 possibleNr�r��chflags�st_flags)�
EOPNOTSUPP�ENOTSUPz$Could not replace file: %s to %s: %sr�s.ansible_tmp)r�r��suffixzQThe destination directory (%s) is not writable by the current user. Error was: %sz�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.Fz=Unable to make %s into to %s, failed final rename from %s: %sz$Failed to replace file: %s to %s: %sr)0r$r�r�r�rKrOrMr�r�rrrNr�r�r�rr�rQrrr�renamer�ZEXDEVrPZETXTBSYZEBUSYr�r#rSrTr"r�r�Zmkstempr��_unsafe_writesr�r��mover�r.r�r�r��DEFAULT_PERM�geteuid�getegid)r�r�r�rvrr�Zb_srcZb_destrreZcreatingZ
b_dest_dirZb_suffixZ	error_msgZ
tmp_dest_nameZtmp_dest_fdZb_tmp_dest_namer�r�r~r~r�atomic_moveus�



 $,�

�
"�� 8.


zAnsibleModule.atomic_movec
Cs�zdd}}z<t|d�}t|d�}t�||�W|r:|��|rb|��n|rT|��|r`|��0WnLtjttfy�}z,|jd||t|�ft	�
�d�WYd}~n
d}~00dS)N�wbr�z/Could not write data to file (%s) from (%s): %sr�)r�r��copyfileobjr�r�r�r�r�r#rSrT)r�r�r�Zout_destZin_srcrr~r~rr��s$


��zAnsibleModule._unsafe_writescCs�|js�|}tr"t|t�r4t|�}nt|t�r4t|�}t|ttf�rLt�|�}g}d}dd�|D�D]h}|rzd}|�	d�qbt
�|�r�|�d�}|dkr�|�	d|d|��qbnd}t
||j�}|�	|�qbd	�d
d�|D��|_|jS)NFcss|]}t|�VqdSr�r�)r�r	r~r~r�	<genexpr>r�z,AnsibleModule._clean_args.<locals>.<genexpr>r�r[rz%s=********Tr%css|]}t|�VqdSr�)rZ)r�r�r~r~rr(r�)r�rPr�rWr$rSr%�shlexrr�
PASSWD_ARG_RErp�findr�r�r�)r�r�Z
to_clean_argsZ
clean_argsZ	is_passwdr�Zsep_idxr~r~r�_clean_args	s4






zAnsibleModule._clean_argscCs"trtjdkrt�tjtj�dS)N�win32)rPr�r|�signal�SIGPIPE�SIG_DFLr
r~r~r�_restore_signal_handlers,sz&AnsibleModule._restore_signal_handlersr�r�c'shd�_t|tttf�s*d}�jd||d�d}|	r�t|t�rRd�dd�|D��}nt|d	d
�}|rzt|d	d
�}|d|g}q��jdvr�t�jd	d
�d|g}q�d
}n\t|ttf�r�t	r�t|d	d
�}nt
r�t|dd
�}t�
|�}|r�dd�|D�}ndd�|D�}d}|
�rnt|
t��r8t
�r&t|
dd
�}
nt	�r8t|
d	d
�}
zt�|
tj�}Wn"tj�yl�jdd�Yn0d}d}d}tj��}|��j�p�i�|�|�p�i�|�r�|�dd�}|�r�d||f|d<n||d<d|v�rdd�|d�
d�D�}|�rt|��rd�|�|d<|�r$tj}��fdd�}t||||tjtj||d�}t
�rd|�rd||d<nt	�rx|�rxd|d<|�r�ttj�tj�|��d	d
�}tj�|��r�||d<n|�sȈjd |d��zJ�j �r��!d!��"|��tj#|fi|��}|�r||�d"}d"} zt$�%�}!Wn t&t'f�y<t$�(�}!Yn0|!�)|j*t$j+�|!�)|j,t$j+�tj-d#k�r�t.�.|j*�/�t.j0t.�.|j*�/�t.j1�tj2B�t.�.|j,�/�t.j0t.�.|j,�/�t.j1�tj2B�|�r|�s�|d$7}t|t��r�t|�}|j3�4|�|j3�5�|!�6d%�}"|"D]\\}#}$|#j7�8�}%|%t9d�k�r:|!�:|#j7�|#j7|j*k�rR||%7}n|#j7|j,k�r| |%7} �q|�r�|�;|��r�|�s�|
�r�t<||
|d&�}d|d'fWS|"�r�|!�=��s�|�>�du�rȐq�n$|!�=��s|�>�du�r|�?��q�q|j*�5�|j,�5�|!�5�|j@}Wn�t't&f�y�}&zT��!d(��"|�t<|&�f�|�rn�j|&jAd"d"t<|&���"|�d)�n|&�WYd}&~&n~d}&~&0tB�y�}&z\��!d(��"|�t<tC�D��f�|�r�jdd"d"t<|&�tC�D���"|�d*�n|&�WYd}&~&n
d}&~&00|dk�r6|�r6tE| �F��jG�}�j��"|�||| |d+�|
du�r^|t<||
|d&�t<| |
|d&�fS||| fS),a#
        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* environ variables 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)
        :kw ignore_invalid_cwd: This flag indicates whether an invalid ``cwd``
            (non-existent or not a directory) should be ignored or should raise
            an exception.
        :kw handle_exceptions: This flag indicates whether an exception will
            be handled inline and issue a failed_json or if the caller should
            handle it.
        :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.
        Nz5Argument 'args' to run_command must be list or stringi)r7�cmdr�F� cSsg|]}tt|�dd��qS)r�r�)r$rZ�r�r�r~r~rr�~r�z-AnsibleModule.run_command.<locals>.<listcomp>r�r�s-c)Nz/bin/shTr�cSs0g|](}|durttj�tj�|��dd��qSr)r$r�r�r�r�rr~r~rr��r�cSs g|]}|durt|dd��qSr)r$rr~r~rr��r�z6invalid prompt regular expression given to run_commandr�r�PATHr{z%s:%sZ
PYTHONPATHcSs(g|] }|r|�d�s|�d�s|�qS)z/ansible_modlib.zipz
/debug_dir)�endswithrr~r~rr��s

�r�cs����rt���dSr�)r
r�r�r~�r�r�r~r�preexec�sz*AnsibleModule.run_command.<locals>.preexec)r��shell�	close_fdsr��stdoutr�Z
preexec_fn�env�pass_fdsrr�z)Provided cwd is not a valid directory: %szExecuting: r��posix�
r")�encodingr�zQA prompt was encountered while running a command, but no input data was specifiedz#Error Executing CMD:%s Exception:%s)r7rr�r�r)r7rr�r�rIr)rr7rr�r�)Hr�r�r�rSrWr�r�r$r�rPrQr%rr�re�compile�	MULTILINEr�r�r��copyr�r�r�any�
subprocess�PIPErr��abspathr�r�r�r�r�Popenr!ZDefaultSelectorr�r�ZPollSelectorr�rZ
EVENT_READr�r��fcntl�filenoZF_SETFLZF_GETFL�
O_NONBLOCKr�r�r��selectZfileobjr�rRZ
unregisterr�r#Zget_mapZpoll�wait�
returncoderr(rSrTr��rstripr�)'r�r�Zcheck_rcrr�r�Zbinary_dataZpath_prefixr�Zuse_unsafe_shellZprompt_regexZenviron_updater�rr�Zexpand_user_and_varsrZbefore_communicate_callbackZignore_invalid_cwdZhandle_exceptionsr�rZ	prompt_rer7Zst_inrr�Zpypathsrr�rrr��selectorZeventsr�ZeventZb_chunkrr~rrra1sB




�


,,






" &
�zAnsibleModule.run_commandcCs4tj�tj�|��}t|d�}|�|�|��dS)Nr	)r�r�r�r�r�r�r�)r�r�rhZfhr~r~r�append_to_file>s

zAnsibleModule.append_to_filecCst|�Sr�)r+)r�r�r~r~rr+DszAnsibleModule.bytes_to_humancCs
t||�Sr�)r,)r��numberZisbitsr~r~rr,JszAnsibleModule.human_to_bytescCsJzt�|d�}Wn4tyDz
tj}Wnty>d}Yn0Yn0|S)Nii(#)r&r(r)ZPIPE_BUF)r�Zbuffer_sizer~r~r�get_buffer_sizeTs
zAnsibleModule.get_buffer_size)	FFNNNFFNN)NNN)N)r)T)N)NT)NT)NT)NT)T)NT)NT)NT)NN)NF)N)FN)N)F)FTNNFNNFNNNr�r�TNNTT)F)G�__name__�
__module__�__qualname__r��propertyr�rerbr
rrrrrr r#r-r0r.r?rCrXrfr_�classmethodrJ�staticmethodrtrsr�r5r�r�r�r�r�r\r�r�r�r�r�r�r;rar&r�r�r�r�r�r�r�r�r0r1r2r�r�r�rr�rr
rar.r+Zpretty_bytesr,r?r0r~r~r~rr��s��
e
&

7	

	
-
)
)
U
+

,

D


(

	
=!

&
#
#�

r�cCstj�tj�t��Sr�)r�r�r"rr�r~r~r~r�get_module_pathcsr7)N)NN)�Z
__future__rrrrgZ
__metaclass__ZFILE_ATTRIBUTES�__main__r�rZdatetimer@r&r�r�r9r|rr)rr�r
rKr"r�r�r�rS�types�	itertoolsrrr�r��ImportErrorZsystemdrrZsystemd_daemonrNZbootedr��AttributeErrorrZansible.module_utils.compatr ZNoneTyper!Z_textr#r$r%Z+ansible.module_utils.common.text.convertersr&r'r�r(Zjson_dict_bytes_to_unicodeZ$ansible.module_utils.common.arg_specr)Z+ansible.module_utils.common.text.formattersr*r+r,r-Z(ansible.module_utils.common._json_compatr.rr�r�r�rr�ZhashlibZ	attributer�r/r�r0r�rnr(ZshaZ/ansible.module_utils.common._collections_compatr3r4r5r6r7r8r9Z"ansible.module_utils.common.localer:Z#ansible.module_utils.common.processr;Z ansible.module_utils.common.filer<r�r=r�r>r�r?r@rAZ$ansible.module_utils.common.sys_inforBrCrDZansible.module_utils.pycompat24rErFZ&ansible.module_utils.common.parametersrGrHrIrJrKrLZansible.module_utils.errorsrMrNrOZansible.module_utils.sixrPrQrRrSrTrUrVrWZansible.module_utils.six.movesrXrYrZZ&ansible.module_utils.common.validationr[r\Z"ansible.module_utils.common._utilsr]r�Z)ansible.module_utils.parsing.convert_boolr^r_r`raZ$ansible.module_utils.common.warningsrbrcrdre�	frozensetr�rrr��imapZunicode�	NameErrorZ
basestringZ
_literal_evalr�r�rrlrorr�version_infoZ_PY3_MINZ_PY2_MINZ_PY_MINr�r��
splitlinesr�r�r�r�r��objectr�r7r~r~r~r�<module>sP�

 


$  	(
	


�





��

A8
=

Zerion Mini Shell 1.0