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

Proposed by Nicolas Pochet
Status: Merged
Merged at revision: da732413353fd2454819caae1304e772cd991562
Proposed branch: ~npochet/ntp-charm/+git/ntp-charm:allow-ntp-choice
Merge into: ~pguimaraes/ntp-charm/+git/ntp-charm:master
Diff against target: 82 lines (+24/-2) (has conflicts)
2 files modified
config.yaml (+12/-0)
lib/ntp_implementation.py (+12/-2)
Conflict in config.yaml
Conflict in lib/ntp_implementation.py
Reviewer Review Type Date Requested Status
Pedro Guimarães Approve
Review via email: mp+365572@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Pedro Guimarães (pguimaraes) :
review: Approve

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 7f86798..3df2756 100644
--- a/config.yaml
+++ b/config.yaml
@@ -44,6 +44,8 @@ options:
44 default: false44 default: false
45 type: boolean45 type: boolean
46 description: >46 description: >
47 DEPRECATED - please DO NOT use if you have more than approximately
48 20 units in this service.
47 Automatically select the most appropriate units in the service to49 Automatically select the most appropriate units in the service to
48 be a service stratum connecting with upstream NTP servers, and use50 be a service stratum connecting with upstream NTP servers, and use
49 those units as time sources for the remaining units.51 those units as time sources for the remaining units.
@@ -51,6 +53,8 @@ options:
51 default: 653 default: 6
52 type: int54 type: int
53 description: >55 description: >
56 DEPRECATED - please DO NOT use if you have more than approximately
57 20 units in this service.
54 How many units should attempt to connect with upstream NTP servers?58 How many units should attempt to connect with upstream NTP servers?
55 use_iburst:59 use_iburst:
56 default: true60 default: true
@@ -62,6 +66,14 @@ options:
62 default: ""66 default: ""
63 type: string67 type: string
64 description: >68 description: >
69<<<<<<< config.yaml
65 Setting as "ntp" will manually install NTPd package or "chrony" will70 Setting as "ntp" will manually install NTPd package or "chrony" will
66 install Chronyd package; disregard of the available OS version. If71 install Chronyd package; disregard of the available OS version. If
67 empty, it will take the version available for the OS72 empty, it will take the version available for the OS
73=======
74 If set to "ntp" the ntp package will be installed and configured, or if set to
75 "chrony" the chrony package will be installed and configured. If unspecified
76 the appropriate package will be selected based on the operating system.
77 Please note that the use of ntp on Ubuntu bionic or later is not recommended as it
78 does not receive security updates.
79>>>>>>> config.yaml
diff --git a/lib/ntp_implementation.py b/lib/ntp_implementation.py
index 0ce4ac6..55abc3c 100644
--- a/lib/ntp_implementation.py
+++ b/lib/ntp_implementation.py
@@ -10,6 +10,7 @@ from charmhelpers.core.hookenv import (
10)10)
11import charmhelpers.contrib.templating.jinja as templating11import charmhelpers.contrib.templating.jinja as templating
12import charmhelpers.core.host12import charmhelpers.core.host
13import charmhelpers.core.hookenv
13import charmhelpers.osplatform14import charmhelpers.osplatform
14import os.path15import os.path
15import shutil16import shutil
@@ -57,11 +58,13 @@ class NTPImplementation:
5758
58 def set_config(self, config):59 def set_config(self, config):
59 with open(self.config_file(), "w") as conffile:60 with open(self.config_file(), "w") as conffile:
60 conffile.write(templating.render(self._config_file_template(), config))61 conffile.write(templating.render(
62 self._config_file_template(), config))
6163
62 def set_startup_options(self, config):64 def set_startup_options(self, config):
63 with open(self._startup_config_file(), "w") as startup:65 with open(self._startup_config_file(), "w") as startup:
64 startup.write(templating.render(self._startup_template_file(), config))66 startup.write(templating.render(
67 self._startup_template_file(), config))
6568
66 def _startup_config_file(self):69 def _startup_config_file(self):
67 raise NotImplementedError70 raise NotImplementedError
@@ -140,9 +143,16 @@ def get_implementation(implementation_name=None):
140 platform = charmhelpers.osplatform.get_platform()143 platform = charmhelpers.osplatform.get_platform()
141 version = float(charmhelpers.core.host.lsb_release()['DISTRIB_RELEASE'])144 version = float(charmhelpers.core.host.lsb_release()['DISTRIB_RELEASE'])
142145
146<<<<<<< lib/ntp_implementation.py
143 if config_get('ntp_package') == "ntp":147 if config_get('ntp_package') == "ntp":
144 return NTPd()148 return NTPd()
145 elif config_get('ntp_package') == "chrony":149 elif config_get('ntp_package') == "chrony":
150=======
151 ntp_package = charmhelpers.core.hookenv.config('ntp_package')
152 if ntp_package == "ntp":
153 return NTPd()
154 elif ntp_package == "chrony":
155>>>>>>> lib/ntp_implementation.py
146 return Chronyd()156 return Chronyd()
147157
148 if platform == 'ubuntu':158 if platform == 'ubuntu':

Subscribers

People subscribed via source and target branches