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
diff --git a/config.yaml b/config.yaml
index f9c541f..f7574a6 100644
--- a/config.yaml
+++ b/config.yaml
@@ -62,3 +62,12 @@ options:
62 description: >62 description: >
63 Use iburst for all peers/sources, not just those received via the63 Use iburst for all peers/sources, not just those received via the
64 master relation.64 master relation.
65 ntp_package:
66 default: ""
67 type: string
68 description: >
69 If set to "ntp" the ntp package will be installed and configured, or if set to
70 "chrony" the chrony package will be installed and configured. If unspecified
71 the appropriate package will be selected based on the operating system.
72 Please note that the use of ntp on Ubuntu bionic or later is not recommended as it
73 does not receive security updates.
diff --git a/lib/ntp_implementation.py b/lib/ntp_implementation.py
index 3e20ccb..c524544 100644
--- a/lib/ntp_implementation.py
+++ b/lib/ntp_implementation.py
@@ -7,6 +7,7 @@
77
8import charmhelpers.contrib.templating.jinja as templating8import charmhelpers.contrib.templating.jinja as templating
9import charmhelpers.core.host9import charmhelpers.core.host
10import charmhelpers.core.hookenv
10import charmhelpers.osplatform11import charmhelpers.osplatform
11import os.path12import os.path
12import shutil13import shutil
@@ -54,11 +55,13 @@ class NTPImplementation:
5455
55 def set_config(self, config):56 def set_config(self, config):
56 with open(self.config_file(), "w") as conffile:57 with open(self.config_file(), "w") as conffile:
57 conffile.write(templating.render(self._config_file_template(), config))58 conffile.write(templating.render(
59 self._config_file_template(), config))
5860
59 def set_startup_options(self, config):61 def set_startup_options(self, config):
60 with open(self._startup_config_file(), "w") as startup:62 with open(self._startup_config_file(), "w") as startup:
61 startup.write(templating.render(self._startup_template_file(), config))63 startup.write(templating.render(
64 self._startup_template_file(), config))
6265
63 def _startup_config_file(self):66 def _startup_config_file(self):
64 raise NotImplementedError67 raise NotImplementedError
@@ -137,6 +140,12 @@ def get_implementation(implementation_name=None):
137 platform = charmhelpers.osplatform.get_platform()140 platform = charmhelpers.osplatform.get_platform()
138 version = float(charmhelpers.core.host.lsb_release()['DISTRIB_RELEASE'])141 version = float(charmhelpers.core.host.lsb_release()['DISTRIB_RELEASE'])
139142
143 ntp_package = charmhelpers.core.hookenv.config('ntp_package')
144 if ntp_package == "ntp":
145 return NTPd()
146 elif ntp_package == "chrony":
147 return Chronyd()
148
140 if platform == 'ubuntu':149 if platform == 'ubuntu':
141 if version > 18:150 if version > 18:
142 # Ubuntu 18.04 or later: use chronyd151 # Ubuntu 18.04 or later: use chronyd

Subscribers

People subscribed via source and target branches