| Server IP : 23.254.227.96 / Your IP : 216.73.216.183 Web Server : Apache/2.4.62 (Unix) OpenSSL/1.1.1k System : Linux hwsrv-1277026.hostwindsdns.com 4.18.0-477.13.1.el8_8.x86_64 #1 SMP Tue May 30 14:53:41 EDT 2023 x86_64 User : viralblo ( 1001) PHP Version : 8.1.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /proc/self/root/lib/python3.6/site-packages/cloudinit/config/__pycache__/ |
Upload File : |
3
?q,d�X � @ s� U d Z ddlZddlZddlmZ ddlmZ ddlmZm Z m
Z
mZmZ ddl
mZmZmZ ddlmZ eje�ZeZdZd Zd
ddd
ddddddddddddgZdddgdddd�ded gd d!dd�d"ed"gd"d!dd�d#d$g d%d&dd�d'�Zd(did(did)�d*dd+�dg dd,�d-�dd.d*iid(diddd+�d/d0id1�d(diddd2�d0d3d4�d1�d(did(did)�d(diddd+�d/d0id1�dd.d*iid5�Zd6d7d8ed9�eed:�ed;�ged<�Zed=d d=d>gd?d@dAdB�dCedD�dE�d?d@dAdB�dCedF�dE�d@dGedH�dI�dJdCedK�dI�edL�d=gd@edM�dN�d@edO�dN�d?dPd@idCedQ�dE�d@edR�dN�d@edS�dN�dT�dUdVdW�dX�dVdY�idZ�Zed/d.d[d(g�Zeee�Z d\d]� Z d^d_� Z!dld`da�Z"dmdbdc�Z#ddde� Z$dndfdg�Z%dhdi� Z&djdk� Z'dS )ozNTP: enable and configure ntp� N)�dedent)�log)�subp�
temp_utils� templater�
type_utils�util)�
MetaSchema�get_meta_doc�validate_cloudconfig_schema)�PER_INSTANCEz
/etc/ntp.conf� � almalinux�alpineZcentosZ
cloudlinux�debian� eurolinuxZfedoraZmiraclelinuxZ openEuler�opensuse�photon�rhelZrocky�sles�ubuntuZ virtuozzoZchronydz/etc/chrony.conf�chronyzchrony.conf.{distro})� check_exe�confpath�packages�service_name�
template_name�template�ntpd�ntpzntp.conf.{distro}�ntpdatez/lib/systemd/systemd-timesyncdz-/etc/systemd/timesyncd.conf.d/cloud-init.confzsystemd-timesyncdztimesyncd.conf)r r r zsystemd-timesyncdr )r r z/etc/chrony/chrony.conf)r r )r r r )r r r r z"/usr/lib/systemd/systemd-timesyncd)r r zsystemd-timesyncd)r r z/etc/systemd/timesyncd.conf)r r )r r r r r r r r Zcc_ntpZNTPzenable and configure ntpaD Handle ntp configuration. If ntp is not installed on the system and
ntp configuration is specified, ntp will be installed. If there is a
default ntp config file in the image or one is present in the
distro's ntp package, it will be copied to a file with ``.dist``
appended to the filename before any changes are made. A list of ntp
pools and ntp servers can be provided under the ``ntp`` config key.
If no ntp ``servers`` or ``pools`` are provided, 4 pools will be used
in the format ``{0-3}.{distro}.pool.ntp.org``.z� # Override ntp with chrony configuration on Ubuntu
ntp:
enabled: true
ntp_client: chrony # Uses cloud-init default chrony configuration
a� # Provide a custom ntp client configuration
ntp:
enabled: true
ntp_client: myntpclient
config:
confpath: /etc/myntpclient/myntpclient.conf
check_exe: myntpclientd
packages:
- myntpclient
service_name: myntpclient
template: |
## template:jinja
# My NTP Client config
{% if pools -%}# pools{% endif %}
{% for pool in pools -%}
pool {{pool}} iburst
{% endfor %}
{%- if servers %}# servers
{% endif %}
{% for server in servers -%}
server {{server}} iburst
{% endfor %}
pools: [0.int.pool.ntp.org, 1.int.pool.ntp.org, ntp.myorg.org]
servers:
- ntp.server.local
- ntp.ubuntu.com
- 192.168.23.2)�id�name�title�description�distrosZexamples� frequency�objectZnullZarray�stringZhostname)�type�formatTa� List of ntp pools. If both pools and servers are
empty, 4 default pool servers will be provided of
the format ``{0-3}.{distro}.pool.ntp.org``. NOTE:
for Alpine Linux when using the Busybox NTP client
this setting will be ignored due to the limited
functionality of Busybox's ntpd.)r) �itemsZuniqueItemsr$ z� List of ntp servers. If both pools and servers are
empty, 4 default pool servers will be provided with
the format ``{0-3}.{distro}.pool.ntp.org``.�autoa� Name of an NTP client to use to configure system NTP.
When unprovided or 'auto' the default client preferred
by the distribution will be used. The following
built-in client names can be used to override existing
configuration defaults: chrony, ntp, ntpdate,
systemd-timesyncd.)r) �defaultr$ Zbooleanz� Attempt to enable ntp clients if set to True. If set
to False, ntp client will not be configured or
installedzu Configuration settings or overrides for the
``ntp_client`` specified.z~ The path to where the ``ntp_client``
configuration is written.)r) r$ z� The executable name for the ``ntp_client``.
For example, ntp service ``check_exe`` is
'ntpd' because it runs the ntpd binary.r) z� List of packages needed to be installed for the
selected ``ntp_client``.z� The systemd or sysvinit service name used to
start and stop the ``ntp_client``
service.aM Inline template allowing users to define their
own ``ntp_client`` configuration template.
The value must start with '## template:jinja'
to enable use of templating support.
)r r r r r � F)r$ r) �
propertiesZ
minProperties�additionalProperties)�pools�servers�
ntp_client�enabled�config)r) r/ r0 )r) r/ r c C s0 t }tjt�}| |kr,tj||| gdd�}|S )z�Construct a distro-specific ntp client config dictionary by merging
distro specific changes into base config.
@param distro: String providing the distro class name.
@returns: Dict of distro configurations for ntp clients.
T)�reverse)�DISTRO_CLIENT_CONFIG�copy�NTP_CLIENT_CONFIGr �
mergemanydict)�distroZdcfg�cfg� r= �/usr/lib/python3.6/cc_ntp.py�distro_ntp_client_configs` s
r? c C s� t |j�}| r.| dkr.tjd| � |j| i �S |jdd�}i }|dkr�x:|jD ]0}|j|�}tj|jd��rNtjd|� |}P qNW |s�|jd }tjd|� |j|�}ntjd|� |j|i �}|S ) a
Determine which ntp client is to be used, consulting the distro
for its preference.
@param ntp_client: String name of the ntp client to use.
@param distro: Distro class instance.
@returns: Dict of the selected ntp client or {} if none selected.
r, z4Selected NTP client "%s" via user-data configurationr3 r z+Selected NTP client "%s", already installedr z<Selected distro preferred NTP client "%s", not yet installedz1Selected NTP client "%s" via distro system config) r? r"