AnonSec Shell
Server IP : 85.193.89.191  /  Your IP : 3.145.57.19
Web Server : Apache
System : Linux 956367-cx40159.tmweb.ru 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64
User : bitrix ( 600)
PHP Version : 8.1.27
Disable Function : NONE
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python2.7/site-packages/ansible/plugins/inventory/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /lib/python2.7/site-packages/ansible/plugins/inventory/script.pyo
�
��\c@`s�ddlmZmZmZeZdZddlZddlZddl	m
Z
ddlmZm
Z
ddlmZddlmZddlmZmZdd	lmZmZd
eefd��YZdS(i(tabsolute_importtdivisiontprint_functions
    inventory: script
    version_added: "2.4"
    short_description: Executes an inventory script that returns JSON
    options:
      cache:
        description: Toggle the usage of the configured Cache plugin.
        default: False
        type: boolean
        ini:
           - section: inventory_plugin_script
             key: cache
        env:
           - name: ANSIBLE_INVENTORY_PLUGIN_SCRIPT_CACHE
      always_show_stderr:
        description: Toggle display of stderr even when script was successful
        version_added: "2.5.1"
        default: True
        type: boolean
        ini:
           - section: inventory_plugin_script
             key: always_show_stderr
        env:
           - name: ANSIBLE_INVENTORY_PLUGIN_SCRIPT_STDERR
    description:
        - The source provided must be an executable that returns Ansible inventory JSON
        - The source must accept C(--list) and C(--host <hostname>) as arguments.
          C(--host) will only be used if no C(_meta) key is present.
          This is a performance optimization as the script would be called per host otherwise.
    notes:
        - It takes the place of the previously hardcoded script inventory.
        - In order to function, it requires being whitelisted in configuration, which is true by default.
N(tMapping(tAnsibleErrortAnsibleParserError(tjson_dict_bytes_to_unicode(t	iteritems(t	to_nativetto_text(tBaseInventoryPlugint	CacheabletInventoryModulecB`sDeZdZdZd�Zd�Zdd�Zd�Zd�Z	RS(sE Host inventory parser for ansible using external inventory scripts. tscriptcC`s#tt|�j�t�|_dS(N(tsuperRt__init__tsett_hosts(tself((sD/usr/lib/python2.7/site-packages/ansible/plugins/inventory/script.pyR:scC`s�tt|�j|�}|r�t}yCt|d��.}|jd�}|jd�r`t}nWdQXWntk
rznXt	j
|t	j�r�|r�t}q�n|S(sP Verify if file is usable by this plugin, base does minimal accessibility check trbis#!N(RRtverify_filetFalsetopentreadt
startswithtTruet	ExceptiontostaccesstX_OK(Rtpathtvalidtshebang_presenttinv_filet
initial_chars((sD/usr/lib/python2.7/site-packages/ansible/plugins/inventory/script.pyR@s
c
C`s�tt|�j|||�|j�|dkrD|jd�}n|dg}y|j|�}|sx||jkr%y%tj	|dtj
dtj
�}Wn8tk
r�}tddj
|�t|�f��nX|j�\}	}
t|�}t|
pd�}|r+|jd�r+|d7}n|jd	krStd
||f��nyt|	dd�}Wn1tk
r�}td
j|t|����nXy|jj|�|j|<Wn4tk
r�}tdj|t|�|���nX|
r%|jd�r%|jjdt|��q%n|j|}
t|
t�s\tdj||���nd}d}xR|
j�D]D\}}|dkr�d|kr�|d}q�qu|j||�quWx�|jD]�}i}|dkr�|j||�}nHy|j |i�}Wn/t!k
r;}td|t|�f��nX|j"|g|�q�WWn%tk
r{}tt|���nXdS(Ntcaches--listtstdouttstderrsproblem running %s (%s)t ts
is1Inventory script (%s) had an execution error: %s terrorststrictsKInventory {0} contained characters that cannot be interpreted as UTF-8: {1}sEfailed to parse executable inventory script results from {0}: {1}
{2}talways_show_stderrtmsgsYfailed to parse executable inventory script results from {0}: needs to be a json dict
{1}t_metathostvarss0Improperly formatted host information for %s: %s(#RRtparsetset_optionstNonet
get_optiont_get_cache_prefixt_cachet
subprocesstPopentPIPEtOSErrorRtjoinRtcommunicatetendswitht
returncodeRR	Rtformattloadertloadtdisplayterrort
isinstanceRtitemst_parse_groupRtget_host_variablestgettAttributeErrort_populate_host_vars(Rt	inventoryR=RR#tcmdt	cache_keytspteR$R%terrtdatat	processedtgrouptdata_from_metatgdatathosttgot((sD/usr/lib/python2.7/site-packages/ansible/plugins/inventory/script.pyR.Usd
%)
"%
 c`s�|jj|�t�t�s/i�d6�n6t�fd�dD��sei|gd6�d6�nd�kr�t�dt�s�td|�f��nx8�dD])}|jj|�|jj	||�q�Wnd�krJt�dt�std|�f��nx7t
�d�D]"\}}|jj|||�q!Wn|dkr�t�t�r�d�kr�x8�dD])}|jj|�|jj||�q|WndS(	Nthostsc3`s|]}|�kVqdS(N((t.0tk(RN(sD/usr/lib/python2.7/site-packages/ansible/plugins/inventory/script.pys	<genexpr>�stvarstchildrens=You defined a group '%s' with bad data for the host list:
 %ss9You defined a group '%s' with bad data for variables:
 %sR,(RUsvarsRY(
RHt	add_groupRAtdicttanytlistRRtaddtadd_hostRtset_variablet	add_child(RRPRNthostnameRWtvt
child_name((RNsD/usr/lib/python2.7/site-packages/ansible/plugins/inventory/script.pyRC�s('cC`s�|d|g}y%tj|dtjdtj�}Wn2tk
rh}tddj|�|f��nX|j�\}}|j�dkr�iSy t|j	j
|d|��SWn'tk
r�td||f��nXd	S(
sI Runs <script> --host <hostname>, to determine additional host variables s--hostR$R%sproblem running %s (%s)R&R't	file_names.could not parse post variable response: %s, %sN(R4R5R6R7RR8R9tstripRR=R>t
ValueError(RRRSRIRKRLtoutRM((sD/usr/lib/python2.7/site-packages/ansible/plugins/inventory/script.pyRD�s%# 
N(
t__name__t
__module__t__doc__tNAMERRR0R.RCRD(((sD/usr/lib/python2.7/site-packages/ansible/plugins/inventory/script.pyR5s		O	(t
__future__RRRttypet
__metaclass__t
DOCUMENTATIONRR4tcollectionsRtansible.errorsRRtansible.module_utils.basicRtansible.module_utils.sixRtansible.module_utils._textRR	tansible.plugins.inventoryR
RR(((sD/usr/lib/python2.7/site-packages/ansible/plugins/inventory/script.pyt<module>s"

Anon7 - 2022
AnonSec Team