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

�N�gz�@sDdZddlZddlZe�e�Zdd�Zdd�Zdd�Z	dd	d
�Z
dS)a 
Management of NTP servers
=========================

.. versionadded:: 2014.1.0

This state is used to manage NTP servers. Currently only Windows is supported.

.. code-block:: yaml

    win_ntp:
      ntp.managed:
        - servers:
          - pool.ntp.org
          - us.pool.ntp.org
�NcCstjj��sdSdS)z$
    This only supports Windows
    )FzOnly Windows supportedZntp)�salt�utils�platformZ
is_windows�rr�C/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/ntp.py�__virtual__srcCs,t|t�sdS|D]
}t|t�sdSq	dS)NFT)�
isinstance�list�str)�serversZserverrrr�_check_servers"s

�rcCs*zttd��WStydhYSw)Nzntp.get_serversF)�set�__salt__�	TypeErrorrrrr�_get_servers+s

�rcCs�|iddd�}t|�sd|d<d|d<t�}t|�}||kr |Stdr6d	|d<d
�d�t|���|d<|Std|�t�}||krTd
|d<t|�t|�d�|d<|Sd|d<d|d<||krkt|�t|�d�|d<|S)zG
    Manage NTP servers

    servers
        A list of NTP servers
    Tz+NTP servers already configured as specified)�name�changes�result�commentFrz%NTP servers must be a list of stringsr�testNz"NTP servers will be updated to: {}z, zntp.set_serverszNTP servers updated)�old�newrzFailed to update NTP servers)rrr
Z__opts__�format�join�sortedr)rr�retZbefore_serversZdesired_serversZ
after_serversrrr�managed2s>��
�
�r)N)�__doc__�loggingZsalt.utils.platformr�	getLogger�__name__�logrrrrrrrr�<module>s