%PDF- %PDF-
Direktori : /lib/python2.7/site-packages/salt/states/ |
Current File : //lib/python2.7/site-packages/salt/states/slack.pyo |
� ���^c @@ sN d Z d d l m Z m Z m Z d d l m Z d � Z d d d � Z d S( u( Send a message to Slack ======================= This state is useful for sending messages to Slack during state runs. .. versionadded:: 2015.5.0 .. code-block:: yaml slack-message: slack.post_message: - channel: '#general' - from_name: SuperAdmin - message: 'This state was executed successfully.' - api_key: peWcBiMOS9HrZG15peWcBiMOS9HrZG15 The api key can be specified in the master or minion configuration like below: .. code-block:: yaml slack: api_key: peWcBiMOS9HrZG15peWcBiMOS9HrZG15 i ( t absolute_importt unicode_literalst print_function( t SaltInvocationErrorc C@ s d t k r d St S( u@ Only load if the slack module is available in __salt__ u slack.post_messageu slack( t __salt__t False( ( ( s5 /usr/lib/python2.7/site-packages/salt/states/slack.pyt __virtual__# s c C@ sR i | d 6i d 6t d 6d d 6} t d rM d j | � | d <d | d <| S| sj d j | � | d <| S| s� d j | � | d <| S| s� d j | � | d <| Sy/ t d d | d | d | d | d | � } Wn) t k r� } d j | | � | d <nP Xt | t � r4| r4t | d <d j | � | d <n d j | d | � | d <| S( u� Send a message to a Slack channel. .. code-block:: yaml slack-message: slack.post_message: - channel: '#general' - from_name: SuperAdmin - message: 'This state was executed successfully.' - api_key: peWcBiMOS9HrZG15peWcBiMOS9HrZG15 The following parameters are required: name The unique name for this event. channel The channel to send the message to. Can either be the ID or the name. from_name The name of that is to be shown in the "from" field. message The message that is to be sent to the Slack channel. The following parameters are optional: api_key The api key for Slack to use for authentication, if not specified in the configuration options of master or minion. icon URL to an image to use as the icon for this message u nameu changesu resultu u commentu testu1 The following message is to be sent to Slack: {0}u Slack channel is missing: {0}u Slack from name is missing: {0}u Slack message is missing: {0}u slack.post_messaget channelt messaget from_namet api_keyt iconu! Failed to send message ({0}): {1}u Sent message: {0}u messageN( R t __opts__t formatt NoneR R t isinstancet boolt True( t nameR R R R R t rett resultt sie( ( s5 /usr/lib/python2.7/site-packages/salt/states/slack.pyt post_message* s>