%PDF- %PDF-
Direktori : /usr/lib/python2.7/site-packages/salt/modules/ |
Current File : //usr/lib/python2.7/site-packages/salt/modules/mattermost.pyc |
� ���^c @@ s� d Z d d l m Z m Z m Z d d l Z d d l Z d d l Z d d l m Z e j e � Z d Z d � Z d � Z d � Z d � Z d � Z d d d d d � Z d S( u� 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 i ( t absolute_importt print_functiont unicode_literalsN( t SaltInvocationErroru mattermostc C@ s t S( uZ Return virtual name of the module. :return: The virtual name of the module. ( t __virtualname__( ( ( s; /usr/lib/python2.7/site-packages/salt/modules/mattermost.pyt __virtual__ s c C@ s9 t d d � p t d d � } | s5 t d � � n | S( up Retrieves and return the Mattermost's configured hook :return: String: the hook string u config.getu mattermost.hooku mattermost:hooku No Mattermost Hook found( t __salt__R ( t hook( ( s; /usr/lib/python2.7/site-packages/salt/modules/mattermost.pyt _get_hook) s c C@ s9 t d d � p t d d � } | s5 t d � � n | S( uv Retrieves and return the Mattermost's configured api url :return: String: the api url string u config.getu mattermost.api_urlu mattermost:api_urlu No Mattermost API URL found( R R ( t api_url( ( s; /usr/lib/python2.7/site-packages/salt/modules/mattermost.pyt _get_api_url7 s c C@ s$ t d d � p t d d � } | S( uk Retrieves the Mattermost's configured channel :return: String: the channel string u config.getu mattermost.channelu mattermost:channel( R ( t channel( ( s; /usr/lib/python2.7/site-packages/salt/modules/mattermost.pyt _get_channelE s c C@ s$ t d d � p t d d � } | S( um Retrieves the Mattermost's configured username :return: String: the username string u config.getu mattermost.usernameu mattermost:username( R ( t username( ( s; /usr/lib/python2.7/site-packages/salt/modules/mattermost.pyt _get_usernameQ s c C@ s | s t � } n | s$ t � } n | s6 t � } n | sH t � } n | s^ t j d � n t � } | rz | | d <n | r� | | d <n d | d | d <t j d | � t d � j t j j j | � � } t j j j d | d | d | � } t | � S( uD Send a message to a Mattermost channel. :param channel: The channel name, either will work. :param username: The username of the poster. :param message: The message to send to the Mattermost channel. :param api_url: The Mattermost api url, if not specified in the configuration. :param hook: The Mattermost hook, if not specified in the configuration. :return: Boolean if message was sent successfully. CLI Example: .. code-block:: bash salt '*' mattermost.post_message message='Build is done' u message is a required option.u channelu usernameu ```u textu Parameters: %su payload={0}R R t data( R R R R t logt errort dictt debugt strt formatt saltt utilst jsont dumpst mattermostt queryt bool( t messageR R R R t parametersR t result( ( s; /usr/lib/python2.7/site-packages/salt/modules/mattermost.pyt post_message] s( $$( t __doc__t __future__R R R t loggingt salt.utils.jsonR t salt.utils.mattermostt salt.exceptionsR t getLoggert __name__R R R R R R R t NoneR ( ( ( s; /usr/lib/python2.7/site-packages/salt/modules/mattermost.pyt <module> s