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
=== modified file 'config.yaml'
--- config.yaml 2013-07-16 07:48:32 +0000
+++ config.yaml 2016-08-01 00:13:12 +0000
@@ -1,4 +1,8 @@
1options:1options:
2 query-hosts:
3 type: string
4 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"
5 default: ""
2 source:6 source:
3 type: string7 type: string
4 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.8 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.
59
=== modified file 'hooks/ntpmaster_hooks.py'
--- hooks/ntpmaster_hooks.py 2016-06-17 12:38:49 +0000
+++ hooks/ntpmaster_hooks.py 2016-08-01 00:13:12 +0000
@@ -34,6 +34,7 @@
34@host.restart_on_change({NTP_CONF: ['ntp']})34@host.restart_on_change({NTP_CONF: ['ntp']})
35def write_config():35def write_config():
36 source = hookenv.config('source')36 source = hookenv.config('source')
37 query_hosts = hookenv.config('query-hosts').split(',')
37 remote_sources = []38 remote_sources = []
38 peers = []39 peers = []
39 local_time = False40 local_time = False
@@ -54,6 +55,7 @@
54 ntp_context = {55 ntp_context = {
55 'fudge_line': local_time,56 'fudge_line': local_time,
56 'peers': peers,57 'peers': peers,
58 'query_hosts': query_hosts,
57 'servers': remote_sources,59 'servers': remote_sources,
58 }60 }
59 with open(NTP_CONF, "w") as ntpconf:61 with open(NTP_CONF, "w") as ntpconf:
6062
=== modified file 'templates/ntp.conf'
--- templates/ntp.conf 2013-08-29 18:29:22 +0000
+++ templates/ntp.conf 2016-08-01 00:13:12 +0000
@@ -6,6 +6,11 @@
6filegen clockstats file clockstats type day enable6filegen clockstats file clockstats type day enable
7restrict -4 default kod notrap nomodify nopeer noquery7restrict -4 default kod notrap nomodify nopeer noquery
8restrict -6 default kod notrap nomodify nopeer noquery8restrict -6 default kod notrap nomodify nopeer noquery
9{% for qh in query_hosts %}
10{% if qh -%}
11restrict {{ qh }} nomodify notrap
12{% endif -%}
13{% endfor %}
9restrict 127.0.0.114restrict 127.0.0.1
10restrict ::115restrict ::1
11# SERVERS16# SERVERS

Subscribers

People subscribed via source and target branches

to all changes: