D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
lib
/
python3.9
/
site-packages
/
ipaclient
/
install
/
__pycache__
/
Filename :
timeconf.cpython-39.opt-1.pyc
back
Copy
a }�f1! � @ s� d dl mZ d dlZd dlZd dlZd dlmZ d dlmZ d dl m Z d dlmZ d dl mZ d dlmZ d d lmZ e�e�Zdd d�Zdd � Zdd� Zddd�ZG dd� de�ZG dd� de�Zdd� Zdd� Zd dd�ZdS )!� )�absolute_importN)�Augeas)�api)�ipautil)�tasks)�services)�paths)� user_inputc C s$ |r|� | � nt�| d| � d S )Nz %s.ipasave)Zbackup_file�shutil�copy)�path�fstore� r �>/usr/lib/python3.9/site-packages/ipaclient/install/timeconf.py�__backup_config$ s r c C s� g } d}t �dd�rxtddd�}|r\t�d� |�d�D ]"}|�� }| �|� t�d |� q8td dd�}|rxt�d|� | |fS )z� While in interactive installation user has to specify NTP server or pool to be used in chrony configuration. This method asks user input on these values in case that they were not specified before installation start. � z@Do you want to configure chrony with NTP server or pool address?FzLEnter NTP source server addresses separated by comma, or press Enter to skipT)Zallow_emptyzUser provided NTP server(s):�,z %sz7Enter a NTP source pool address, or press Enter to skipzUser provided NTP pool: %s)r r �logger�debug�split�strip�append)�ntp_servers�ntp_poolZservers�serverr r r �get_time_source+ s( �� �r c C s� t jj�� t jj�� d} d}tjddt| �ddt|�g}z$t� d� t �|� t� d� W dS t jy� t� d � t� d � Y dS 0 dS ) z� This method enables chronyd service on boot and restarts it to reload chrony configuration file /etc/chrony.conf Then it tries to synchronize time with chrony's new or defaut configuration � � z-dZwaitsync�0z%Attempting to sync time with chronyc.z$Time synchronization was successful.Tz-Process chronyc waitsync failed to sync time!z�Unable to sync time with chrony server, assuming the time is in sync. Please check that 123 UDP port is opened, and any time server is on network.FN)r � knownservices�chronyd�enableZrestartr ZCHRONYC�strr �infor �runZCalledProcessErrorZwarning)Zsync_attempt_countZsync_attempt_interval�argsr r r �sync_chronyI s$ � �r&