SHA256
1
0
forked from pool/cloud-init
cloud-init/0003-Distro-dependent-chrony-config-file.patch
Robert Schweikert fb31094f97 - Update to version 17.2 (boo#1069635, bsc#1072811)
+ Add cloud-init-skip-ovf-tests.patch
  + Add cloud-init-no-python-linux-dist.patch
  + Add 0001-switch-to-using-iproute2-tools.patch
  + Add 0001-Support-chrony-configuration-lp-1731619.patch
  + Add 0002-Disable-method-deprecation-warning-for-pylint.patch
  + Add 0003-Distro-dependent-chrony-config-file.patch
  + removed cloud-init-add-variant-cloudcfg.patch replaced by
    cloud-init-no-python-linux-dist.patch
  + removed zypp_add_repos.diff included upstream
  + removed zypp_add_repo_test.patch included upstream
  + removed cloud-init-hosts-template.patch included upstream
  + removed cloud-init-more-tasks.patch included upstream
  + removed cloud-init-final-no-apt.patch included upstream
  + removed cloud-init-ntp-conf-suse.patch included upstream
  + removed cloud-init-break-cycle-local-service.patch included upstream
  + removed cloud-init-reproduce-build.patch included upstream
  + For the complete changelog see https://launchpad.net/cloud-init/trunk/17.2

OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/cloud-init?expand=0&rev=105
2018-01-29 21:11:23 +00:00

93 lines
3.2 KiB
Diff

From 42cb1841035befa5b5823b3321c8fe92f2cb9087 Mon Sep 17 00:00:00 2001
From: Robert Schweikert <rjschwei@suse.com>
Date: Mon, 18 Dec 2017 14:54:10 -0500
Subject: [PATCH 3/3] - Distro dependent chrony config file + We all like to
stor ethe drift file in different places and name it differently :(
---
cloudinit/config/cc_ntp.py | 8 +++++--
...{chrony.conf.tmpl => chrony.conf.opensuse.tmpl} | 0
templates/chrony.conf.sles.tmpl | 25 ++++++++++++++++++++++
3 files changed, 31 insertions(+), 2 deletions(-)
rename templates/{chrony.conf.tmpl => chrony.conf.opensuse.tmpl} (100%)
create mode 100644 templates/chrony.conf.sles.tmpl
diff --git a/cloudinit/config/cc_ntp.py b/cloudinit/config/cc_ntp.py
index 2f662a9e..1db648bc 100644
--- a/cloudinit/config/cc_ntp.py
+++ b/cloudinit/config/cc_ntp.py
@@ -50,6 +50,7 @@ schema = {
'examples': [
dedent("""\
ntp:
+ enabled: true
pools: [0.int.pool.ntp.org, 1.int.pool.ntp.org, ntp.myorg.org]
servers:
- ntp.server.local
@@ -61,6 +62,9 @@ schema = {
'ntp': {
'type': ['object', 'null'],
'properties': {
+ 'enabled': {
+ "type": "boolean"
+ },
'pools': {
'type': 'array',
'items': {
@@ -109,7 +113,7 @@ def handle(name, cfg, cloud, log, _args):
if not isinstance(ntp_cfg, (dict)):
raise RuntimeError(("'ntp' key existed in config,"
" but not a dictionary type,"
- " is a %s %instead"), type_utils.obj_name(ntp_cfg))
+ " is a %s instead"), type_utils.obj_name(ntp_cfg))
if ntp_cfg.get('enabled') and ntp_cfg.get('enabled') == 'true':
cloud.distro.set_timesync_client()
@@ -129,7 +133,7 @@ def handle(name, cfg, cloud, log, _args):
template_name = 'timesyncd.conf'
elif client_name == 'chrony':
confpath = CHRONY_CONF_FILE
- template_name = 'chrony.conf'
+ template_name = 'chrony.conf.%s' % cloud.distro.name
else:
if ntp_installable():
service_name = 'ntp'
diff --git a/templates/chrony.conf.tmpl b/templates/chrony.conf.opensuse.tmpl
similarity index 100%
rename from templates/chrony.conf.tmpl
rename to templates/chrony.conf.opensuse.tmpl
diff --git a/templates/chrony.conf.sles.tmpl b/templates/chrony.conf.sles.tmpl
new file mode 100644
index 00000000..38e84d85
--- /dev/null
+++ b/templates/chrony.conf.sles.tmpl
@@ -0,0 +1,25 @@
+## template:jinja
+# cloud-init generated file
+# See chrony.conf(5)
+
+{% if pools %}# pools
+{% endif %}
+{% for pool in pools -%}
+pool {{pool}} iburst
+{% endfor %}
+{%- if servers %}# servers
+{% endif %}
+{% for server in servers -%}
+server {{server}} iburst
+{% endfor %}
+
+# Record the rate at which the the system clock gains/losses time
+driftfile /var/lib/chrony/drift
+
+# Allow the system clock to be stepped in the first three updates
+# if its offset is larger than 1 second.
+makestep 1.0 3
+
+# Enable kernel synchronization of the real-time clock (RTC).
+rtcsync
+
--
2.13.6