Merge ~pguimaraes/ntp-charm/+git/ntp-charm:master into ntp-charm:master

Proposed by Pedro GuimarĂ£es
Status: Superseded
Proposed branch: ~pguimaraes/ntp-charm/+git/ntp-charm:master
Merge into: ntp-charm:master
Diff against target: 58 lines (+20/-2)
2 files modified
config.yaml (+9/-0)
lib/ntp_implementation.py (+11/-2)
Reviewer Review Type Date Requested Status
Joel Sing Pending
Review via email: mp+365573@code.launchpad.net

This proposal supersedes a proposal from 2019-02-26.

This proposal has been superseded by a proposal from 2019-04-05.

Commit message

Added manual override on NTP package selection.
LP: #1817516

Description of the change

Added manual override on NTP package selection.
LP: #1817516

To post a comment you must log in.
Revision history for this message
đŸ¤– Canonical IS Merge Bot (canonical-is-mergebot) wrote : Posted in a previous version of this proposal

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
Joel Sing (jsing) : Posted in a previous version of this proposal
review: Needs Fixing
Revision history for this message
đŸ¤– Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

1c8cbc9... by Pedro GuimarĂ£es

Removed unused config_get from lib/ntp_implementation.py

Unmerged commits

1c8cbc9... by Pedro GuimarĂ£es

Removed unused config_get from lib/ntp_implementation.py

da73241... by Pedro GuimarĂ£es

Merged changes from commit allow-ntp-choice

6e39713... by Nicolas Pochet

Code cleanup

8f68125... by Przemyslaw Hausman

Fix testing the value of ntp_package config option

c94981b... by Przemyslaw Hausman

Fix yaml parsing error due to the \t character used

65a8104... by Pedro GuimarĂ£es

Added manual override on NTP package selection.
LP: #1817516

2fe6f6c... by Przemyslaw Hausman

Fix testing the value of ntp_package config option

62be0f8... by Przemyslaw Hausman

Fix yaml parsing error due to the \t character used

6256555... by Pedro GuimarĂ£es

Added manual override on NTP package selection.
LP: #1817516

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/config.yaml b/config.yaml
2index f9c541f..f7574a6 100644
3--- a/config.yaml
4+++ b/config.yaml
5@@ -62,3 +62,12 @@ options:
6 description: >
7 Use iburst for all peers/sources, not just those received via the
8 master relation.
9+ ntp_package:
10+ default: ""
11+ type: string
12+ description: >
13+ If set to "ntp" the ntp package will be installed and configured, or if set to
14+ "chrony" the chrony package will be installed and configured. If unspecified
15+ the appropriate package will be selected based on the operating system.
16+ Please note that the use of ntp on Ubuntu bionic or later is not recommended as it
17+ does not receive security updates.
18diff --git a/lib/ntp_implementation.py b/lib/ntp_implementation.py
19index 3e20ccb..c524544 100644
20--- a/lib/ntp_implementation.py
21+++ b/lib/ntp_implementation.py
22@@ -7,6 +7,7 @@
23
24 import charmhelpers.contrib.templating.jinja as templating
25 import charmhelpers.core.host
26+import charmhelpers.core.hookenv
27 import charmhelpers.osplatform
28 import os.path
29 import shutil
30@@ -54,11 +55,13 @@ class NTPImplementation:
31
32 def set_config(self, config):
33 with open(self.config_file(), "w") as conffile:
34- conffile.write(templating.render(self._config_file_template(), config))
35+ conffile.write(templating.render(
36+ self._config_file_template(), config))
37
38 def set_startup_options(self, config):
39 with open(self._startup_config_file(), "w") as startup:
40- startup.write(templating.render(self._startup_template_file(), config))
41+ startup.write(templating.render(
42+ self._startup_template_file(), config))
43
44 def _startup_config_file(self):
45 raise NotImplementedError
46@@ -137,6 +140,12 @@ def get_implementation(implementation_name=None):
47 platform = charmhelpers.osplatform.get_platform()
48 version = float(charmhelpers.core.host.lsb_release()['DISTRIB_RELEASE'])
49
50+ ntp_package = charmhelpers.core.hookenv.config('ntp_package')
51+ if ntp_package == "ntp":
52+ return NTPd()
53+ elif ntp_package == "chrony":
54+ return Chronyd()
55+
56 if platform == 'ubuntu':
57 if version > 18:
58 # Ubuntu 18.04 or later: use chronyd

Subscribers

People subscribed via source and target branches