File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/mattermost.cpython-310.pyc
Back
o ;j� � @ sl d Z ddlZddlZddlZddlmZ e�e�Z dZ dd� Zdd� Zd d � Z dd� Zd d� Zddd�ZdS )a� Module for sending messages to Mattermost .. versionadded:: 2017.7.0 :configuration: This module can be used by either passing an api_url and hook directly or by specifying both in a configuration profile in the salt master/minion config. For example: .. code-block:: yaml mattermost: hook: peWcBiMOS9HrZG15peWcBiMOS9HrZG15 api_url: https://example.com � N)�SaltInvocationError� mattermostc C s t S )zZ Return virtual name of the module. :return: The virtual name of the module. )�__virtualname__� r r �K/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/mattermost.py�__virtual__ s r c C �( t d d�pt d d�} | std��| S )zp Retrieves and return the Mattermost's configured hook :return: String: the hook string � config.getzmattermost.hookzmattermost:hookzNo Mattermost Hook found��__salt__r )�hookr r r � _get_hook% � �r c C r )zv Retrieves and return the Mattermost's configured api url :return: String: the api url string r zmattermost.api_urlzmattermost:api_urlzNo Mattermost API URL foundr )�api_urlr r r �_get_api_url4 r r c C � t d d�pt d d�} | S )zk Retrieves the Mattermost's configured channel :return: String: the channel string r zmattermost.channelzmattermost:channel�r )�channelr r r �_get_channelC � �r c C r )zm Retrieves the Mattermost's configured username :return: String: the username string r zmattermost.usernamezmattermost:usernamer )�usernamer r r � _get_usernameP r r c C s� |st � }|s t� }|st� }|st� }| st�d� t� }|r$||d<