| From 36029e9ec08d85a57f834f617c9ee5a73aa80090 Mon Sep 17 00:00:00 2001 |
| From: Varsha Teratipally <teratipally@google.com> |
| Date: Wed, 25 Aug 2021 22:03:11 +0000 |
| Subject: [PATCH] enable NTP for cos |
| |
| --- |
| cloudinit/config/cc_ntp.py | 8 ++------ |
| templates/chrony.conf.ubuntu.tmpl | 15 +-------------- |
| 2 files changed, 3 insertions(+), 20 deletions(-) |
| |
| diff --git a/cloudinit/config/cc_ntp.py b/cloudinit/config/cc_ntp.py |
| index 5498bbaa..fcba31cd 100644 |
| --- a/cloudinit/config/cc_ntp.py |
| +++ b/cloudinit/config/cc_ntp.py |
| @@ -28,9 +28,9 @@ distros = ['centos', 'debian', 'fedora', 'opensuse', 'rhel', 'sles', 'ubuntu'] |
| NTP_CLIENT_CONFIG = { |
| 'chrony': { |
| 'check_exe': 'chronyd', |
| - 'confpath': '/etc/chrony.conf', |
| + 'confpath': '/etc/chrony/chrony.conf', |
| 'packages': ['chrony'], |
| - 'service_name': 'chrony', |
| + 'service_name': 'chronyd', |
| 'template_name': 'chrony.conf.{distro}', |
| 'template': None, |
| }, |
| @@ -450,10 +450,6 @@ def write_ntp_config_template(distro_name, service_name=None, servers=None, |
| servers = generate_server_names(distro_name) |
| LOG.debug( |
| 'Adding distro default ntp servers: %s', ','.join(servers)) |
| - elif len(servers) == 0 and len(pools) == 0: |
| - pools = generate_server_names(distro_name) |
| - LOG.debug( |
| - 'Adding distro default ntp pool servers: %s', ','.join(pools)) |
| |
| if not path: |
| raise ValueError('Invalid value for path parameter') |
| diff --git a/templates/chrony.conf.ubuntu.tmpl b/templates/chrony.conf.ubuntu.tmpl |
| index 50a6f518..3b538f95 100644 |
| --- a/templates/chrony.conf.ubuntu.tmpl |
| +++ b/templates/chrony.conf.ubuntu.tmpl |
| @@ -13,26 +13,13 @@ pool {{pool}} iburst |
| {%- if servers %}# servers |
| {% endif %} |
| {% for server in servers -%} |
| -server {{server}} iburst |
| +server {{server}} iburst minpoll 4 maxpoll 4 |
| {% endfor %} |
| |
| -# This directive specify the location of the file containing ID/key pairs for |
| -# NTP authentication. |
| -keyfile /etc/chrony/chrony.keys |
| - |
| # This directive specify the file into which chronyd will store the rate |
| # information. |
| driftfile /var/lib/chrony/chrony.drift |
| |
| -# Uncomment the following line to turn logging on. |
| -#log tracking measurements statistics |
| - |
| -# Log files location. |
| -logdir /var/log/chrony |
| - |
| -# Stop bad estimates upsetting machine clock. |
| -maxupdateskew 100.0 |
| - |
| # This directive enables kernel synchronisation (every 11 minutes) of the |
| # real-time clock. Note that it can’t be used along with the 'rtcfile' directive. |
| rtcsync |
| -- |
| 2.33.0.259.gc128427fd7-goog |
| |
| |