File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/splunk.cpython-310.pyc
Back
o ;j� � @ s� d Z ddlZddlZddlZddlZdZzddlZddlm Z ddlm Z dZW n ey1 Y nw e�e �ZdZdZg d�Zg d �Zd d� Zdd � Zdd� Zdd� Zd dd�Zdd� Zd dd�Zd dd�Zd dd�Zd dd�Zd dd�ZdS )!a� Module for interop with the Splunk API .. versionadded:: 2016.3.0 :depends: - splunk-sdk python module :configuration: Configure this module by specifying the name of a configuration profile in the minion config, minion pillar, or master config. The module will use the 'splunk' key by default, if defined. For example: .. code-block:: yaml splunk: username: alice password: abc123 host: example.splunkcloud.com port: 8080 � NF)� HTTPError)�AuthenticationErrorT�splunk)�realname�roles� defaultApp�tz�name)r r r c C s t rtS dS )zF Only load this module if splunk is installed on this minion. )Fz[The splunk execution module failed to load: requires splunk python library to be installed.)�HAS_LIBS�__virtualname__� r r �G/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/splunk.py�__virtual__8 s r c C s t d | �}|�d�S )N� config.optionZpassword_secret_key)�__salt__�get)�profile�configr r r �_get_secret_keyE s r c C s8 t �t�td��t| tg��}t�|�� �� � � dd�S )Nr �=� )�hmac�new�base64� b64decoder �str�SERVICE_NAME�urlsafe_b64encode�digest�strip�replace)�email�mr r r �_generate_passwordJ s �r# c C s� t d d�}|�d�}|r[|�d�}|�d�}|�d��| | t|�| �}ztjdd|d ||gtjd �}W n tyM } z t� d||� W Y d}~nd}~ww |� |� t�d |� dS dS )z/send a email to inform user of account creationr r r! �cc�subject�messageZmailz-sz-c)�stdinzunable to send email to %s: %sNz!sent account creation email to %s)r r �formatr# � subprocess�Popen�PIPE� Exception�log�error�communicate�info) r r! r Zemail_objectr$ r% r&