summaryrefslogtreecommitdiff
path: root/cloudinit/config/cc_ntp.py
diff options
context:
space:
mode:
authorChad Smith <chad.smith@canonical.com>2017-11-16 20:58:45 -0700
committerChad Smith <chad.smith@canonical.com>2017-11-16 20:58:45 -0700
commitd90318b21d0379e24337bcb92a0a90ebfa359c35 (patch)
tree598603dd1a072f1e4e34ef745511a77e05033904 /cloudinit/config/cc_ntp.py
parent6ad23fe9b11f07e4404c8a1f2f1e9cba2640dceb (diff)
downloadvyos-cloud-init-d90318b21d0379e24337bcb92a0a90ebfa359c35.tar.gz
vyos-cloud-init-d90318b21d0379e24337bcb92a0a90ebfa359c35.zip
ntp: fix configuration template rendering for openSUSE and SLES
Add opensuse distro support to cc_ntp module. LP: #1726572
Diffstat (limited to 'cloudinit/config/cc_ntp.py')
-rw-r--r--cloudinit/config/cc_ntp.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/cloudinit/config/cc_ntp.py b/cloudinit/config/cc_ntp.py
index d43d060c..f50bcb35 100644
--- a/cloudinit/config/cc_ntp.py
+++ b/cloudinit/config/cc_ntp.py
@@ -23,7 +23,7 @@ frequency = PER_INSTANCE
NTP_CONF = '/etc/ntp.conf'
TIMESYNCD_CONF = '/etc/systemd/timesyncd.conf.d/cloud-init.conf'
NR_POOL_SERVERS = 4
-distros = ['centos', 'debian', 'fedora', 'opensuse', 'ubuntu']
+distros = ['centos', 'debian', 'fedora', 'opensuse', 'sles', 'ubuntu']
# The schema definition for each cloud-config module is a strict contract for
@@ -174,8 +174,13 @@ def rename_ntp_conf(config=None):
def generate_server_names(distro):
names = []
+ pool_distro = distro
+ # For legal reasons x.pool.sles.ntp.org does not exist,
+ # use the opensuse pool
+ if distro == 'sles':
+ pool_distro = 'opensuse'
for x in range(0, NR_POOL_SERVERS):
- name = "%d.%s.pool.ntp.org" % (x, distro)
+ name = "%d.%s.pool.ntp.org" % (x, pool_distro)
names.append(name)
return names