Merge lp:~paulgear/charms/trusty/ntpmaster/add-query-hosts-option into lp:charms/trusty/ntpmaster

Proposed by Paul Gear
Status: Merged
Merged at revision: 18
Proposed branch: lp:~paulgear/charms/trusty/ntpmaster/add-query-hosts-option
Merge into: lp:charms/trusty/ntpmaster
Diff against target: 48 lines (+11/-0)
3 files modified
config.yaml (+4/-0)
hooks/ntpmaster_hooks.py (+2/-0)
templates/ntp.conf (+5/-0)
To merge this branch: bzr merge lp:~paulgear/charms/trusty/ntpmaster/add-query-hosts-option
Reviewer Review Type Date Requested Status
Review Queue (community) automated testing Approve
Chris Glass (community) Approve
Stuart Bishop (community) Approve
Review via email: mp+301602@code.launchpad.net

Description of the change

Adds an option to allow user-specified query hosts. We need this for our production environment, which uses ntpq -pn remotely for Nagios checks.

To post a comment you must log in.
Revision history for this message
Stuart Bishop (stub) wrote :

Looks good.

review: Approve
Revision history for this message
Kevin W Monroe (kwmonroe) wrote :

Thanks for the feature Paul! I'm adding ~landscape-charmers to the requested reviewers. This needs to be pushed to their namespace to become available in the store.

Landscape charmers, assuming you approve of this code change, please push with:

charm push <path to branch> cs:~landscape-charmers/trusty/ntpmaster

Revision history for this message
Chris Glass (tribaal) wrote :

Looks good! +1

review: Approve
Revision history for this message
Review Queue (review-queue) wrote :

The results (PASS) are in and available here: http://juju-ci.vapour.ws/job/charm-bundle-test-aws/5716/

review: Approve (automated testing)
Revision history for this message
Review Queue (review-queue) wrote :

The results (PASS) are in and available here: http://juju-ci.vapour.ws/job/charm-bundle-test-lxc/5615/

review: Approve (automated testing)
Revision history for this message
Review Queue (review-queue) wrote :

The results (PASS) are in and available here: http://juju-ci.vapour.ws/job/charm-bundle-test-lxc/5616/

review: Approve (automated testing)
Revision history for this message
Review Queue (review-queue) wrote :

The results (PASS) are in and available here: http://juju-ci.vapour.ws/job/charm-bundle-test-lxc/5617/

review: Approve (automated testing)
Revision history for this message
Review Queue (review-queue) wrote :

The results (PASS) are in and available here: http://juju-ci.vapour.ws/job/charm-bundle-test-lxc/5618/

review: Approve (automated testing)
Revision history for this message
Review Queue (review-queue) wrote :

The results (PASS) are in and available here: http://juju-ci.vapour.ws/job/charm-bundle-test-lxc/5619/

review: Approve (automated testing)
Revision history for this message
Review Queue (review-queue) wrote :

The results (PASS) are in and available here: http://juju-ci.vapour.ws/job/charm-bundle-test-lxc/5620/

review: Approve (automated testing)
Revision history for this message
Review Queue (review-queue) wrote :

The results (PASS) are in and available here: http://juju-ci.vapour.ws/job/charm-bundle-test-lxc/5621/

review: Approve (automated testing)
Revision history for this message
Review Queue (review-queue) wrote :

The results (PASS) are in and available here: http://juju-ci.vapour.ws/job/charm-bundle-test-lxc/5622/

review: Approve (automated testing)
Revision history for this message
Review Queue (review-queue) wrote :

The results (PASS) are in and available here: http://juju-ci.vapour.ws/job/charm-bundle-test-lxc/5623/

review: Approve (automated testing)
Revision history for this message
Review Queue (review-queue) wrote :

The results (PASS) are in and available here: http://juju-ci.vapour.ws/job/charm-bundle-test-lxc/5624/

review: Approve (automated testing)
Revision history for this message
Review Queue (review-queue) wrote :

The results (PASS) are in and available here: http://juju-ci.vapour.ws/job/charm-bundle-test-lxc/5625/

review: Approve (automated testing)
Revision history for this message
Review Queue (review-queue) wrote :

The results (PASS) are in and available here: http://juju-ci.vapour.ws/job/charm-bundle-test-lxc/5626/

review: Approve (automated testing)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'config.yaml'
2--- config.yaml 2013-07-16 07:48:32 +0000
3+++ config.yaml 2016-08-01 00:13:12 +0000
4@@ -1,4 +1,8 @@
5 options:
6+ query-hosts:
7+ type: string
8+ description: Comma-separated list of restrict clauses which are allowed to query the server for time monitoring purposes. e.g. "10.1.1.0 mask 255.255.255.0"
9+ default: ""
10 source:
11 type: string
12 description: Space separated list of NTP servers and options to use as source for time. Use LOCAL if the machine has no references but itself.
13
14=== modified file 'hooks/ntpmaster_hooks.py'
15--- hooks/ntpmaster_hooks.py 2016-06-17 12:38:49 +0000
16+++ hooks/ntpmaster_hooks.py 2016-08-01 00:13:12 +0000
17@@ -34,6 +34,7 @@
18 @host.restart_on_change({NTP_CONF: ['ntp']})
19 def write_config():
20 source = hookenv.config('source')
21+ query_hosts = hookenv.config('query-hosts').split(',')
22 remote_sources = []
23 peers = []
24 local_time = False
25@@ -54,6 +55,7 @@
26 ntp_context = {
27 'fudge_line': local_time,
28 'peers': peers,
29+ 'query_hosts': query_hosts,
30 'servers': remote_sources,
31 }
32 with open(NTP_CONF, "w") as ntpconf:
33
34=== modified file 'templates/ntp.conf'
35--- templates/ntp.conf 2013-08-29 18:29:22 +0000
36+++ templates/ntp.conf 2016-08-01 00:13:12 +0000
37@@ -6,6 +6,11 @@
38 filegen clockstats file clockstats type day enable
39 restrict -4 default kod notrap nomodify nopeer noquery
40 restrict -6 default kod notrap nomodify nopeer noquery
41+{% for qh in query_hosts %}
42+{% if qh -%}
43+restrict {{ qh }} nomodify notrap
44+{% endif -%}
45+{% endfor %}
46 restrict 127.0.0.1
47 restrict ::1
48 # SERVERS

Subscribers

People subscribed via source and target branches

to all changes: