HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/states/__pycache__/msteams.cpython-310.pyc
o

�N�g
�@s&dZddlmZdd�Zddd�ZdS)	a
Send a message card to Microsoft Teams
======================================

This state is useful for sending messages to Teams during state runs.

.. versionadded:: 2017.7.0

.. code-block:: yaml

    teams-message:
      msteams.post_card:
        - message: 'This state was executed successfully.'
        - hook_url:  https://outlook.office.com/webhook/837

The hook_url can be specified in the master or minion configuration like below:

.. code-block:: yaml

    msteams:
      hook_url: https://outlook.office.com/webhook/837
�)�SaltInvocationErrorcCsdtvrdSdS)zB
    Only load if the msteams module is available in __salt__
    �msteams.post_cardZmsteams)Fz"msteams module could not be loaded)�__salt__�rr�G/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/msteams.py�__virtual__srNc
Cs�|iddd�}tdrd�|�|d<d|d<|S|s#d	|��|d<|Sztd
||||d�}WntyL}zd|�d
|��|d<WYd}~|Sd}~wwt|t�ra|rad|d<d|��|d<|Sd�|d|�|d<|S)a�
    Send a message to a Microsft Teams channel

    .. code-block:: yaml

        send-msteams-message:
          msteams.post_card:
            - message: 'This state was executed successfully.'
            - hook_url: https://outlook.office.com/webhook/837

    The following parameters are required:

    message
        The message that is to be sent to the MS Teams channel.

    The following parameters are optional:

    hook_url
        The webhook URL given configured in Teams interface,
        if not specified in the configuration options of master or minion.
    title
        The title for the card posted to the channel
    theme_color
        A hex code for the desired highlight color
    F�)�nameZchanges�result�comment�testz0The following message is to be sent to Teams: {}rNr
zTeams message is missing: r)�message�hook_url�title�theme_colorzFailed to send message (z): TzSent message: zFailed to send message ({}): {}r
)Z__opts__�formatrr�
isinstance�bool)r	r
rrr�retr
Zsierrr�	post_card$s<�
�
����r)NNN)�__doc__Zsalt.exceptionsrrrrrrr�<module>s