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

Proposed by Pedro Guimarães
Status: Merged
Approved by: Joel Sing
Approved revision: 1c8cbc9dca0ae4f18438301d8b7baa7a6becb3eb
Merged at revision: 5becfec9524043bcbacb195194e174cbd1185817
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 (community) +1 Approve
Review via email: mp+365574@code.launchpad.net

This proposal supersedes 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 : 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
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

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

Revision history for this message
Joel Sing (jsing) wrote :

The last update in the associated bug says that this is not needed:

  https://bugs.launchpad.net/ntp-charm/+bug/1817516/comments/12

Is this not the case?

review: Needs Information
Revision history for this message
Nicolas Pochet (npochet) wrote :

A response was added to the bug https://bugs.launchpad.net/ntp-charm/+bug/1817516/comments/13. Could we please merge this?

Revision history for this message
Joel Sing (jsing) wrote :

LGTM

review: Approve (+1)
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision 5becfec9524043bcbacb195194e174cbd1185817

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