blob: 872efe6eb494be76a66f3e965b54c50e95dce77f [file] [log] [blame] [edit]
From ca31291001d89d5fa7ea12061892eb5927b355a9 Mon Sep 17 00:00:00 2001
From: Varsha Teratipally <teratipally@google.com>
Date: Thu, 20 Oct 2022 05:13:37 +0000
Subject: [PATCH 4/5] enable NTP for cos
---
cloudinit/config/cc_ntp.py | 9 +++------
templates/chrony.conf.ubuntu.tmpl | 15 +--------------
2 files changed, 4 insertions(+), 20 deletions(-)
diff --git a/cloudinit/config/cc_ntp.py b/cloudinit/config/cc_ntp.py
index 8d834336e19d..462d6efb607b 100644
--- a/cloudinit/config/cc_ntp.py
+++ b/cloudinit/config/cc_ntp.py
@@ -56,9 +56,9 @@ distros = [
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,
},
@@ -486,10 +486,7 @@ def write_ntp_config_template(
servers = generate_server_names(distro_name)
LOG.debug("Adding distro default ntp servers: %s", ",".join(servers))
elif not (servers) and not (pools):
- pools = generate_server_names(distro_name)
- LOG.debug(
- "Adding distro default ntp pool servers: %s", ",".join(pools)
- )
+ return
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 06da6123cb4b..9a897b7c20ad 100644
--- a/templates/chrony.conf.ubuntu.tmpl
+++ b/templates/chrony.conf.ubuntu.tmpl
@@ -13,7 +13,7 @@ pool {{pool}} iburst
{%- if servers %}# servers
{% endif %}
{% for server in servers -%}
-server {{server}} iburst
+server {{server}} iburst minpoll 4 maxpoll 4
{% endfor %}
{% for peer in peers -%}
peer {{peer}}
@@ -22,23 +22,10 @@ peer {{peer}}
allow {{a}}
{% 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.41.0.487.g6d72f3e995-goog