File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/solr.cpython-310.pyc
Back
o ;j�� � @ s\ d Z ddlZddlZddlZddlZdd� Zdd� Zdd� Z dEd d�Z dFdd �ZdGdd�Zdd� Z dHdd�ZdGdd�ZdFdd�Zdd� Zdd� ZdFdd�ZdHdd�ZdHd d!�ZdHd"d#�ZdFd$d%�ZdFd&d'�ZdFd(d)�ZdFd*d+�ZdFd,d-�ZdId/d0�ZdFd1d2�ZdFd3d4�ZdHd5d6�ZdFd7d8�Z dFd9d:�Z!dId;d<�Z"dId=d>�Z#dJd?d@�Z$dJdAdB�Z%dIdCdD�Z&dS )Ka� Apache Solr Salt Module Author: Jed Glazner Version: 0.2.1 Modified: 12/09/2011 This module uses HTTP requests to talk to the apache solr request handlers to gather information and report errors. Because of this the minion doesn't necessarily need to reside on the actual slave. However if you want to use the signal function the minion must reside on the physical solr host. This module supports multi-core and standard setups. Certain methods are master/slave specific. Make sure you set the solr.type. If you have questions or want a feature request please ask. Coming Features in 0.3 ---------------------- 1. Add command for checking for replication failures on slaves 2. Improve match_index_versions since it's pointless on busy solr masters 3. Add additional local fs checks for backups to make sure they succeeded Override these in the minion config ----------------------------------- solr.cores A list of core names e.g. ['core1','core2']. An empty list indicates non-multicore setup. solr.baseurl The root level URL to access solr via HTTP solr.request_timeout The number of seconds before timing out an HTTP/HTTPS/FTP request. If nothing is specified then the python global timeout setting is used. solr.type Possible values are 'master' or 'slave' solr.backup_path The path to store your backups. If you are using cores and you can specify to append the core name to the path in the backup method. solr.num_backups For versions of solr >= 3.5. Indicates the number of backups to keep. This option is ignored if your version is less. solr.init_script The full path to your init script with start/stop options solr.dih.options A list of options to pass to the DIH. Required Options for DIH ------------------------ clean : False Clear the index before importing commit : True Commit the documents to the index upon completion optimize : True Optimize the index after commit is complete verbose : True Get verbose output � Nc C s( t jj�d�r dS t jj�d�rdS dS )zZ PRIVATE METHOD Solr needs to be installed to use this. Return: str/bool Zsolrzapache-solr)FzfThe solr execution module failed to load: requires both the solr and apache-solr binaries in the path.)�salt�utils�path�which� r r �E/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/solr.py�__virtual__F s r c C s6 | du rdS | s | S t | t�r| �� dkrdS | S dS )ag PRIVATE METHOD Checks to see if the value of a primitive or built-in container such as a list, dict, set, tuple etc is empty or none. None type is returned if the value is empty/None/False. Number data types that are 0 will return None. value : obj The primitive or built-in container to evaluate. Return: None or value N�none)� isinstance�str�lower)�valuer r r �_get_none_or_valueX s r c C s t td d��dkS )z� PRIVATE METHOD Checks to see if using_cores has been set or not. if it's been set return it, otherwise figure it out and set it. Then return it Return: boolean True if one or more cores defined in __opts__['solr.cores'] � config.option� solr.coresr )�len�__salt__r r r r �_check_for_coresr s r Tc C sB |du ri n|}|du rg n|}|du rg n|}| |||d�}|S )a PRIVATE METHOD Creates a new return dict with default values. Defaults may be overwritten. success : boolean (True) True indicates a successful result. data : dict<str,obj> ({}) Data to be returned to the caller. errors : list<str> ([()]) A list of error messages to be returned to the caller warnings : list<str> ([]) A list of warnings to be returned to the caller. Return: dict<str,obj>:: {'success':boolean, 'data':dict, 'errors':list, 'warnings':list} N)�success�data�errors�warningsr )r r r r �retr r r �_get_return_dict s r c C sZ |du rg n|}|du rg n|}|| d<