403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /lib/python3.11/site-packages/ansible/cli/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /lib/python3.11/site-packages/ansible/cli/__pycache__/inventory.cpython-311.opt-1.pyc
�

���c!@�� �ddlmZmZmZeZddlmZddlZddl	Z	ddl
mZddl
m
Z
ddlmZddlmZmZddlmZmZmZdd	lmZdd
lmZddlmZmZe��Ze gd���Z!Gd
�de��Z"dd�Z#e$dkre#��dSdS)�)�absolute_import�division�print_function)�CLIN)�	constants)�context)�option_helpers)�AnsibleError�AnsibleOptionsError)�to_bytes�	to_native�to_text)�combine_vars)�Display)�get_vars_from_inventory_sources�get_vars_from_path)�ansible_diff_mode�ansible_config_file�
ansible_facts�
ansible_forks�ansible_inventory_sources�
ansible_limit�ansible_playbook_python�ansible_run_tags�ansible_skip_tags�ansible_verbosity�ansible_version�
inventory_dir�inventory_file�inventory_hostname�inventory_hostname_short�groups�group_names�omit�playbook_dirc����eZdZdZdZddd�Z�fd�Z�fd�Z�fd�Z�fd	�Z	e
d
���Zd�Zd�Z
d
�Ze
d���Ze
d���Ze
d���Ze
dd���Zdd�Zd�Zd�Zd�Zd�Z�xZS)�InventoryCLIzE used to display or dump the configured inventory as Ansible sees it zansible-inventoryzHThe name of a host to match in the inventory, relevant when using --listzAThe name of a group in the inventory, relevant when using --graph)�host�groupc���tt|���|��d|_d|_d|_dS�N)�superr'�__init__�vm�loader�	inventory)�self�args�	__class__s  ��:/usr/lib/python3.11/site-packages/ansible/cli/inventory.pyr-zInventoryCLI.__init__9s:���
�l�D�!�!�*�*�4�0�0�0������������c�v��tt|���dd���tj|j��tj|j��tj|j��tj|j��|j�	ddtjtjd���|j�	dtjtj�	��|j�	d
dd���|j�
d
d��}|�	ddddd���|�	ddddd���|�	ddddd���|j�
|��|j�	dddddd���|j�	d ddd!d"���|j�	d#ddd$d%���|j�	d&dtjd'd(���|j�	d)dd*d+�,��dS)-Nz#usage: %prog [options] [host|group]zWShow Ansible inventory information, by default it uses the inventory script JSON format)�usage�epilogz-lz--limit�?)�help�action�nargsz--list-hosts)r:r;r2z
host|group)�metavarr<�Actionsz6One of following must be used on invocation, ONLY ONE!z--list�
store_trueF�listz0Output all hosts info, works as inventory script)r;�default�destr:z--host�storer(z4Output specific host info, works as inventory scriptz--graph�graphzJcreate inventory graph, if supplying pattern it must be a valid group namez-yz--yaml�yamlz<Use YAML format instead of default JSON, ignored for --graphz--toml�tomlz<Use TOML format instead of default JSON, ignored for --graphz--vars�	show_varsz;Add vars to graph display, ignored unless used with --graphz--export�exportz�When doing an --list, represent in a way that is optimized for export,not as an accurate representation of how Ansible has processed itz--output�output_filezHWhen doing --list, send the inventory to a file instead of to the screen)rArBr:)r,r'�init_parser�opt_help�add_inventory_options�parser�add_vault_options�add_basedir_options�add_runtask_options�add_argument�argparse�SUPPRESS�UnrecognizedArgument�add_argument_group�C�INVENTORY_EXPORT)r1�action_groupr3s  �r4rJzInventoryCLI.init_parser@s����
�l�D�!�!�-�-�7�l�	.�	n�	n�	n�	�&�t�{�3�3�3��"�4�;�/�/�/��$�T�[�1�1�1��$�T�[�1�1�1�	
�� � ��y�x�7H�QY�Qn�vy� �z�z�z��� � ��h�6G�PX�Pm� �n�n�n��� � ���S� �I�I�I��{�5�5�i�Ay�z�z���!�!�(�<��U[�cU�!�	V�	V�	V��!�!�(�7�D�v�]S�!�	T�	T�	T��!�!�)�L�%�V]�'s�	"�	u�	u�	u���&�&�|�4�4�4�	
�� � ��x��e�Z`�&d�	!�	f�	f�	f��� � ��,��TZ�&d�	!�	f�	f�	f��� � ��,��T_�&c�	!�	e�	e�	e�	
�� � ��L�!�J\�ck�'j�	!�	k�	k�	k�	
�� � ��T�
�&p�	!�	r�	r�	r�	r�	rr5c�n��tt|���|��}|jt_|�|��d}|j|j|jfD]	}|r|dz
}�
|dkrtd���|dkrtd���|j
r
|j
|_nd|_|S)Nr�zTNo action selected, at least one of --host, --graph or --list needs to be specified.z]Conflicting options used, only one of --host, --graph or --list can be used at the same time.�all)r,r'�post_process_args�	verbosity�display�validate_conflictsr@r(rDrr2�pattern)r1�options�used�optr3s    �r4r\zInventoryCLI.post_process_argsis������d�+�+�=�=�g�F�F��#�-�������(�(�(����L�'�,��
�>�	�	�C��
���	����1�9�9�%�&|�}�}�}�
�A�X�X�%�'F�G�G�
G��<�	$�%�l�G�O�O�#�G�O��r5c	�L��tt|�����|���\|_|_|_d}tjdr~|j�	tjd��}t|��dkrtd���|�|d���}|�
|��}n�tjdr|���}n�tjdr�|�d��}tjd	r|�|��}n=tjd
r|�|��}n|�|��}|�
|��}|r�tjd}|�t&�|��n�	t)t+|��d��5}|�t+|����ddd��n#1swxYwYnH#t.t0f$r4}t3d
t5|���dt5|�������d}~wwxYwt7jd��t7jd��dS)Nr(rZz5You must pass a single valid host to --host parameterr�r(rDr@r[rErFrI�wbz%Unable to write to destination file (z): )r,r'�run�
_play_prereqsr/r0r.r�CLIARGS�	get_hosts�lenr�_get_host_variables�dump�inventory_graph�
_get_group�yaml_inventory�toml_inventory�json_inventoryr^�openr�write�OSError�IOErrorr
r
�sys�exit)	r1�results�hosts�myvars�top�outfile�f�er3s	        �r4rgzInventoryCLI.run�s����
�l�D�!�!�%�%�'�'�'�04�/A�/A�/C�/C�,���T�^�T�W����?�6�"�	)��N�,�,�W�_�V�-D�E�E�E��5�z�z�Q���)�*a�b�b�b��-�-�5��8�-�<�<�F��i�i��'�'�G�G�
�_�W�
%�
	)��*�*�,�,�G�G�
�_�V�
$�	)��/�/�%�(�(�C���v�&�
3��-�-�c�2�2������(�
3��-�-�c�2�2����-�-�c�2�2���i�i��(�(�G��	��o�m�4�G�������(�(�(�(�|��h�w�/�/��6�6�3�!������ 1� 1�2�2�2�3�3�3�3�3�3�3�3�3�3�3����3�3�3�3�����)�|�|�|�&�,�Yb�cj�Yk�Yk�Yk�Yk�mv�wx�my�my�my�'z�{�{�{�����|�����H�Q�K�K�K��������s<�H4�9#H(�H4�(H,�,H4�/H,�0H4�4I9�/I4�4I9c	�x�tjdr1ddl}ddlm}t|�||dd�����}n�tjdraddlm}	||��}n�#t$r}td	|z���d}~wt$r"}td
|jdz���d}~wwxYwddl
}ddlm}	|�||dddd�
��}n\#t$rO}|�||dddd�
��}t"�dt'|��z��Yd}~nd}~wwxYw|S)NrEr)�
AnsibleDumperFT)�Dumper�default_flow_style�
allow_unicoderF)�
toml_dumpszLThe source inventory contains a value that cannot be represented in TOML: %saThe source inventory contains a non-string key (%s) which cannot be represented in TOML. The specified key will need to be converted to a string. Be aware that if your playbooks expect this key to be non-string, your playbooks will need to be modified to support this change.)�AnsibleJSONEncoder�)�cls�	sort_keys�indent�preprocess_unsafe�ensure_asciiz?Could not sort JSON output due to issues while sorting keys: %s)rrirE�ansible.parsing.yaml.dumperr�rrm�ansible.plugins.inventory.tomlr��	TypeErrorr
�KeyErrorr2�json�ansible.parsing.ajsonr��dumpsr^�warningr
)�stuffrEr�ryr�rr�r�s        r4rmzInventoryCLI.dump�s����?�6�"�	r��K�K�K�A�A�A�A�A�A��d�i�i��m�X]�mq�i�r�r�s�s�G�G�
�_�V�
$�	r�A�A�A�A�A�A�
�$�*�U�+�+�����
�
�
�"�b�ef�f���������
�
�
�"��!"��q�	�*��������
����
�K�K�K�@�@�@�@�@�@�
r��*�*�U�0B�d�[\�pt�DI�*�J�J�����
r�
r�
r��*�*�U�0B�e�\]�qu�EJ�*�K�K����� a�dm�no�dp�dp� p�q�q�q�q�q�q�q�q�����
r�����s=�A)�)
B4�3B�
B4�B/�/B4�C�
D7�(AD2�2D7c	�n�|���}t|t|j|jj|gd����}tjdr6t|t|jtjd|gd����}|j	dkr
|j	|d<|�
|��S)Nr[�basedirrZ�ansible_group_priority)�get_varsrrr/r0�_sourcesrrir�priority�_remove_internal)r1r)�ress   r4�_get_group_variablesz!InventoryCLI._get_group_variables�s����n�n�����3� ?���T�^�Md�gl�fm�ot� u� u�v�v���?�9�%�	q��s�$6�t�{�G�O�T]�D^�af�`g�in�$o�$o�p�p�C��>�Q���,1�N�C�(�)��$�$�S�)�)�)r5c	��tjdr�|���}t|t	|j|jj|gd����}tjdr6t|t|jtjd|gd����}n|j	�|dd���}|�
|��S)NrHr[r�F)r(�include_hostvars�stage)rrir�rrr/r0r�rr.r�)r1r(�hostvarss   r4rlz InventoryCLI._get_host_variables�s����?�8�$�
	X��}�}���H�$�H�.M�d�k�[_�[i�[r�uy�tz�}B�/C�/C�D�D�H���y�)�
~�'��2D�T�[�RY�Ra�bk�Rl�os�nt�v{�2|�2|�}�}����w�'�'�T�E�QV�'�W�W�H��$�$�X�.�.�.r5c�D�|jj�|��}|Sr+)r0r"�get)r1�gnamer)s   r4rozInventoryCLI._get_group�s����%�)�)�%�0�0���r5c�(�tD]	}||vr||=�
|Sr+)�
INTERNAL_VARS)rm�internals  r4r�zInventoryCLI._remove_internal�s+��&�	#�	#�H��4�����N���r5c�.�dD]}||vr||s||=�dS)N)rz�vars�children�)rm�xs  r4�
_remove_emptyzInventoryCLI._remove_empty�s6��/�	�	�A��D�y�y��a��y���G��	�	r5c
���g}t|�����D]:\}}|�t�d|�d|�d�|�����;|S)N�{z = �})�sorted�items�appendr'�_graph_name)rm�depth�result�name�vals     r4�
_show_varszInventoryCLI._show_varssf����!�$�*�*�,�,�/�/�	V�	V�K�T�3��M�M�,�2�2�2�$�$�$����3L�e�T�T�U�U�U�U��
r5rc� �|rd|zd|zz}|S)Nz  |z--%sr�)r�r�s  r4r�zInventoryCLI._graph_name	s!���	3��E�?�V�d�]�2�D��r5c�x�|�d|jz|��g}|dz}|jD]+}|�|�||�����,|jdkr�|jD]�}|�|�|j|����tjdr?|�|�	|�
|��|dz������tjdr<|�|�	|�|��|����|S)Nz@%s:rZr[rG)r�r��child_groups�extend�_graph_grouprzr�rrir�rlr�)r1r)r�r��kidr(s      r4r�zInventoryCLI._graph_groups.���"�"�6�E�J�#6��>�>�?����	���%�	9�	9�C��M�M�$�+�+�C��7�7�8�8�8�8��:������
^�
^���
�
�d�.�.�t�y�%�@�@�A�A�A��?�;�/�^��M�M�$�/�/�$�2J�2J�4�2P�2P�RW�Z[�R[�"\�"\�]�]�]���?�;�'�	T��M�M�$�/�/�$�*C�*C�E�*J�*J�E�R�R�S�S�S��
r5c��|�tjd��}|r(d�|�|����Std���)Nr`�
z3Pattern must be valid group name when using --graph)rorri�joinr�r)r1�start_ats  r4rnzInventoryCLI.inventory_graph!sR���?�?�7�?�9�#=�>�>���	]��9�9�T�.�.�x�8�8�9�9�9�%�&[�\�\�\r5c������t������fd���|��}dii|d<�j���}|D]/}��|��}|r||dd|j<�0|S)Nc�T��i}i||j<|jdkrd�|jD��||jd<g||jd<|jD]n}||jd�|j��|j�vr8|��|������|j���otjdr#��|��||jd<��	||j��||js||j=|S)Nr[c��g|]	}|j��
Sr�)r�)�.0�hs  r4�
<listcomp>zEInventoryCLI.json_inventory.<locals>.format_group.<locals>.<listcomp>1s��/L�/L�/L�1���/L�/L�/Lr5rzr�rHr�)
r�rzr�r��update�addrrir�r�)r)ry�subgroup�format_group�seenr1s   ���r4r�z1InventoryCLI.json_inventory.<locals>.format_group-s-����G�"$�G�E�J���z�U�"�"�/L�/L���/L�/L�/L���
�#�G�,�.0�G�E�J��
�+�!�.�
,�
,����
�#�J�/�6�6�x�}�E�E�E��=��,�,��N�N�<�<��#9�#9�:�:�:��H�H�X�]�+�+�+����x�(�
O�.2�.G�.G��.N�.N���
�#�F�+����w�u�z�2�3�3�3��5�:�&�
(��E�J�'��Nr5r��_meta)�setr0rjrlr�)r1r|ryrzr(�hvarsr�r�s`     @@r4rrzInventoryCLI.json_inventory)s�������u�u��	�	�	�	�	�	�	�(�,�s�#�#��'��+������(�(�*�*���	@�	@�D��,�,�T�2�2�E��
@�:?��� ��,�T�Y�7���r5c�0����g����fd���|��S)Nc�p��i}i||j<i||jd<|jD]<}|jdkr/||jd��|�����=i||jd<|jdkr`|jD]X}i}|j�vr0��|j����|���}|||jd|j<�Ytjdr'��|��}|r|||jd<��	||j��|S)Nr�r[rzrerHr�)
r�r�r�rzr�rlrrir�r�)	r)ryr�r�r{�gvarsr�r�r1s	      ���r4r�z1InventoryCLI.yaml_inventory.<locals>.format_groupQsZ����G�#%�G�E�J��/1�G�E�J��
�+�!�.�
S�
S���=�E�)�)��E�J�'�
�3�:�:�<�<��;Q�;Q�R�R�R��,.�G�E�J���(��z�U�"�"���B�B�A��F��v�T�)�)����A�F�+�+�+�!%�!9�!9�q�!9�!A�!A��;A�G�E�J�'��0���8�8���x�(�
8��1�1�%�8�8���8�27�G�E�J�'��/����w�u�z�2�3�3�3��Nr5r�)r1r|r�r�s` @@r4rpzInventoryCLI.yaml_inventoryMs?�������	�	�	�	�	�	�	�>�|�C� � � r5c������t���ttd�|jD�����������fd���|��}|S)Nc3�:K�|]}|jdk�
|jV��dS)�	ungroupedN)r�rz)r��gs  r4�	<genexpr>z.InventoryCLI.toml_inventory.<locals>.<genexpr>ts1����!]�!]�a�q�v�Q\�G\�G\�!�'�G\�G\�G\�G\�!]�!]r5c���i}i||j<g||jd<|jD]d}|jdkr�s�|jdkr+||jd�|j��|��|�����e|jdkr�|jD]�}|j�vr1��|j����|���}ni}	|||jd|j<�[#t$r|j|i||jd<Y�~wxYwtj	dr#��
|��||jd<��||j��||js||j=|S)Nr�r�r[rerzrHr�)r�r�r�r�rzr�rlr�rrir�r�)	r)ryr�r(�	host_varsr��
has_ungroupedr�r1s	     ����r4r�z1InventoryCLI.toml_inventory.<locals>.format_groupvs�����G�"$�G�E�J��.0�G�E�J��
�+�!�.�
7�
7���=�K�/�/�
�/���:��&�&��E�J�'�
�3�:�:�8�=�I�I�I����|�|�H�5�5�6�6�6�6��z�U�"�"�!�K�	N�	N�D��y��,�,������+�+�+�$(�$<�$<�$�$<�$G�$G�	�	�$&�	�N�BK���
�+�G�4�T�Y�?�?��#�N�N�N�8<�	�9�7M���
�+�G�4�4�4�N������x�(�
O�.2�.G�.G��.N�.N���
�#�F�+����w�u�z�2�3�3�3��5�:�&�
(��E�J�'��Ns�C7�7!D�D)r��bool�nextr�)r1r|ryr�r�r�s`  @@@r4rqzInventoryCLI.toml_inventoryrsu�������u�u���T�!]�!]�3�3C�!]�!]�!]�]�]�^�^�
�	�	�	�	�	�	�	�	�B�,�s�#�#���r5)r)�__name__�
__module__�__qualname__�__doc__r��	ARGUMENTSr-rJr\rg�staticmethodrmr�rlror�r�r�r�r�rnrrrprq�
__classcell__)r3s@r4r'r'1s��������O�O��D�c�]�a�a�I������%r�%r�%r�%r�%r�R�����0+�+�+�+�+�Z����\��@
*�
*�
*�/�/�/� �������\������\������\�������\��
����$]�]�]�"�"�"�H#!�#!�#!�J'�'�'�'�'�'�'r5r'c�:�t�|��dSr+)r'�cli_executor)r2s r4�mainr��s�����d�#�#�#�#�#r5�__main__r+)%�
__future__rrr�type�
__metaclass__�ansible.clirrwrR�ansiblerrVr�ansible.cli.argumentsr	rK�ansible.errorsr
r�ansible.module_utils._textrr
r�ansible.utils.varsr�ansible.utils.displayr�ansible.vars.pluginsrrr^�	frozensetr�r'r�r�r�r5r4�<module>r�s���C�B�B�B�B�B�B�B�B�B��
�������
�
�
�
�����"�"�"�"�"�"�������<�<�<�<�<�<�<�<�<�<�<�<�<�<�C�C�C�C�C�C�C�C�C�C�+�+�+�+�+�+�)�)�)�)�)�)�T�T�T�T�T�T�T�T�
�'�)�)���	�-�-�-�.�.�
�*h�h�h�h�h�3�h�h�h�V$�$�$�$��z����D�F�F�F�F�F��r5

Youez - 2016 - github.com/yon3zu
LinuXploit