Mini Shell
3
C��e� � @ s� d Z ddlZddlZddlZddlZddlZddlZddlmZ ddl m
Z
mZ ddlm
Z
dZejd�ZdZG d d
� d
e�Zdd� Zd
d� Zdd� Zeefdd�Zeedfdd�Zddd�Zddd�ZdS )zO
Module facilitating the work with NTP servers and NTP daemon's configuration
� N)�isys)� threadMgr�AnacondaThread)�THREAD_SYNC_TIME_BASENAMEz/etc/chrony.confz4^\s*(server|pool)\s*([-a-zA-Z.0-9]+)\s*[a-zA-Z]+\s*$� c @ s e Zd ZdZdS )�NTPconfigErrorz(Exception class for NTP related problemsN)�__name__�
__module__�__qualname__�__doc__� r r �/usr/lib64/python3.6/ntp.pyr - s r c C sZ t j� }y|j| � W n> t jk
r, dS tjk
r@ dS tjk
rT dS X dS )a
Tries to do an NTP request to the $server (timeout may take some time).
:param server: hostname or IP address of an NTP server
:type server: string
:return: True if the given server is reachable and working, False otherwise
:rtype: bool
FT)�ntplib� NTPClient�request�NTPException�socket�gaierror�error)�server�clientr r r
�ntp_server_working2 s r c C s0 g }x| D ]}|j t|g � q
W |j |� |S )N)�extend�SERVERS_PER_POOL)�pools�servers�ret�poolr r r
�pools_servers_to_internalN s
r c C s� t � }g }g }x | D ]}|j|d�d ||<