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__/win_snmp.cpython-310.pyc
o

�N�g{�@s.dZdd�Zddd�Zddd�Zdd	d
�ZdS)
z@
Module for managing SNMP service settings on Windows servers.

cCsdtvrdSdS)z=
    Load only on minions that have the win_snmp module.
    �win_snmp.get_agent_settingsT)Fz#win_snmp module could not be loaded)�__salt__�rr�H/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/win_snmp.py�__virtual__srNc
Cs`|iddd�}t�t�d�}|sdg}tt|��}|||d�}td�}|D]}t||�t||�krA||||d�|d	|<q&|d	sPd
|d<d|d
<|Stdr^d|d<||d	<|Stddi|��td�}	|D]}|||	|kr�|||	|d�|d|<|d	�|d�qn|dr�d|d<||d	<d|d
<|Sd|d<|d	|d	<d|d
<|S)a�
    Manage the SNMP sysContact, sysLocation, and sysServices settings.

    :param str contact: The SNMP contact.
    :param str location: The SNMP location.
    :param str services: A list of selected services.

    Example of usage:

    .. code-block:: yaml

        snmp-agent-settings:
            win_snmp.agent_settings:
                - contact: Test Contact
                - location: Test Location
                - services:
                    - Physical
                    - Internet
    �N��name�changes�comment�result�r	�failures�None)�contact�location�servicesr��old�newr	z3Agent settings already contain the provided values.r
Tr�testzAgent settings will be changed.zwin_snmp.set_agent_settingsr
z%Some agent settings failed to change.Fz2Set agent settings to contain the provided values.r)�dict�sorted�setr�str�__opts__�pop)
rrrr�retZret_settingsZsettingsZcurrent_settingsZsettingZnew_settingsrrr�agent_settingssN
��
���rTcCs�|iddd�}d}td�}||kr|�d�|d<d|d	<|Std
r3|�d�|d<||d�|d
<|Sd|�d�|d<||d�|d
<td|d�|d	<|S)z�
    Manage the sending of authentication traps.

    :param bool status: The enabled status.

    Example of usage:

    .. code-block:: yaml

        snmp-auth-traps:
            win_snmp.auth_traps_enabled:
                - status: True
    rNrZEnableAuthenticationTrapszwin_snmp.get_auth_traps_enabledz% already contains the provided value.r
Trrz will be changed.rr	zSet z to contain the provided value.zwin_snmp.set_auth_traps_enabled)�status)rr)rrr�vnameZcurrent_statusrrr�auth_traps_enabledWs
	��r cCs�|t�ddd�}t�t�d�}|st�}td�}|D]}||vr,||dd�|d|<q|D]}d}||vr;||}|||krL|||d�|d|<q/|ds[d|d	<d
|d<|Stdrid
|d	<||d<|Std|d�td�}|D]}	|	|vr�||	||	d�|d|	<|d�|	d�qw|D]%}d}
||vr�||}
|||
kr�|||
d�|d|<|d�|d�q�|dr�d|d	<||d<d|d<|Sd|d	<|d|d<d
|d<|S)a�
    Manage the SNMP accepted community names and their permissions.

    :param str communities: A dictionary of SNMP communities and permissions.

    Example of usage:

    .. code-block:: yaml

        snmp-community-names:
            win_snmp.community_names:
                - communities:
                    TestCommunity: Read Only
                    OtherCommunity: Read Write
    rNrrzwin_snmp.get_community_namesrr	z0Communities already contain the provided values.r
TrrzCommunities will be changed.zwin_snmp.set_community_names)�communitiesr
z"Some communities failed to change.Fz/Set communities to contain the provided values.)rrrr)rr!rZret_communitiesZcurrent_communitiesZ
current_vnamerZ
current_vdataZnew_communitiesZ	new_vnameZ	new_vdatarrr�community_namesxsp
����
�����r")N)T)�__doc__rrr r"rrrr�<module>s

	
G!