File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/elasticsearch.cpython-310.pyc
Back
o ;j�� � @ st d Z ddlZddlmZmZ e�e�ZzddlZddlm Z e�d�� ej� dZW n e y5 dZY nw dd � Zdnd d�Zdodd �Zdndd�Zdpdd�Zdqdd�Zdrdd�Z dsdd�Zdpdd�Zdtdd�Zdtdd�Zdrdd �Zdtd!d"�Z dud#d$�Zdnd%d&�Zdvd(d)�Zdvd*d+�Zdtd,d-�Zdnd.d/�Z dnd0d1�Z!dnd2d3�Z" 4 dwd5d6�Z# 7 dxd8d9�Z$dnd:d;�Z%dtd<d=�Z&dtd>d?�Z'dnd@dA�Z(dndBdC�Z)dtdDdE�Z*dndFdG�Z+dndHdI�Z,dndJdK�Z-dndLdM�Z.dndNdO�Z/dndPdQ�Z0dodRdS�Z1dndTdU�Z2dndVdW�Z3dndXdY�Z4dodZd[�Z5dnd\d]�Z6dnd^d_�Z7dnd`da�Z8 dydbdc�Z9 doddde�Z:drdfdg�Z;drdhdi�Z<dndjdk�Z=dndldm�Z>dS )za� Elasticsearch - A distributed RESTful search and analytics server Module to provide Elasticsearch compatibility to Salt (compatible with Elasticsearch version 1.5.2+) .. versionadded:: 2015.8.0 :depends: `elasticsearch-py <http://elasticsearch-py.readthedocs.org/en/latest/>`_ :configuration: This module accepts connection configuration details either as parameters or as configuration settings in /etc/salt/minion on the relevant minions: .. code-block:: yaml elasticsearch: host: '10.10.10.100:9200' elasticsearch-cluster: hosts: - '10.10.10.100:9200' - '10.10.10.101:9200' - '10.10.10.102:9200' elasticsearch-extra: hosts: - '10.10.10.100:9200' use_ssl: True verify_certs: True ca_certs: /path/to/custom_ca_bundle.pem number_of_shards: 1 number_of_replicas: 0 functions_blacklist: - 'saltutil.find_job' - 'pillar.items' - 'grains.items' proxies: - http: http://proxy:3128 - https: http://proxy:1080 When specifying proxies the requests backend will be used and the 'proxies' data structure is passed as-is to that module. This data can also be passed into pillar. Options passed into opts will overwrite options passed into pillar. Some functionality might be limited by elasticsearch-py and Elasticsearch server versions. � N)�CommandExecutionError�SaltInvocationError)�RequestsHttpConnection� elasticsearchTFc C s t sdS dS )z5 Only load if elasticsearch libraries exist. )FzCCannot load module elasticsearch: elasticsearch libraries not foundT)�HAS_ELASTICSEARCH� r r �N/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/elasticsearch.py�__virtual__G s r c C sp d}d}d}d}d}d}d}|du rd}t |t�r!td |d�} nt |t�r(|} | rj| �d| �} | s8| �d| �} | �d d�}| �d d�}| �dd�}| �dd�}| �d d�} | �dd�}| �dd�}| rj|rj| |f}| sodg} t | t�rw| g} z*|r�G dd� dt�}tj| |||||||d�}ntj| |||||d�}|�� W |S tj j y� } ztd�| | ���d} ~ ww )z+ Return the elasticsearch instance NFT� r z config.option�host�hosts�proxies�use_ssl�ca_certs�verify_certs�username�password�timeoutz127.0.0.1:9200c s e Zd Z� fdd�Z� ZS )z&_get_instance.<locals>.ProxyConnectionc s* |� di �}t� j|i |�� || j_d S )Nr )�pop�super�__init__�sessionr )�self�args�kwargsr �� __class__r r r } s z/_get_instance.<locals>.ProxyConnection.__init__)�__name__� __module__�__qualname__r � __classcell__r r r r �ProxyConnection| s r! )Zconnection_classr r r r � http_authr )r r r r"