Merge lp:~cjwatson/charms/trusty/turnip/allow-rsync into lp:~canonical-launchpad-branches/charms/trusty/turnip/devel

Proposed by Colin Watson
Status: Merged
Merged at revision: 76
Proposed branch: lp:~cjwatson/charms/trusty/turnip/allow-rsync
Merge into: lp:~canonical-launchpad-branches/charms/trusty/turnip/devel
Diff against target: 56 lines (+23/-0)
3 files modified
config.yaml (+4/-0)
hooks/services.py (+11/-0)
templates/turnip-rsync.j2 (+8/-0)
To merge this branch: bzr merge lp:~cjwatson/charms/trusty/turnip/allow-rsync
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+258520@code.launchpad.net

Commit message

Add configuration to open rsync log access to certain hosts.

Description of the change

Add configuration to open rsync log access to certain hosts.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) wrote :

It's a little weird that this magically works because of basenode.

review: Approve (code)

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 2015-04-27 01:59:44 +0000
3+++ config.yaml 2015-05-07 16:04:22 +0000
4@@ -102,6 +102,10 @@
5 description: |
6 A list of repository URLs to run end-to-end checks on. Multiple
7 entries should be separated by spaces.
8+ log_hosts_allow:
9+ type: string
10+ default: ""
11+ description: Hosts that should be allowed to rsync logs.
12
13 # apt configuration used by charmhelpers.
14 install_sources:
15
16=== modified file 'hooks/services.py'
17--- hooks/services.py 2015-04-27 01:59:44 +0000
18+++ hooks/services.py 2015-05-07 16:04:22 +0000
19@@ -19,6 +19,16 @@
20 group=config['code_group'])
21
22
23+def render_rsync_template(config):
24+ if config['log_hosts_allow']:
25+ return helpers.render_template(
26+ source='turnip-rsync.j2',
27+ target='/etc/rsyncd.d/010-turnip',
28+ perms=0o644)
29+ else:
30+ return lambda _: None
31+
32+
33 def manage():
34 if hookenv.hook_name() in ('install', 'upgrade-charm'):
35 actions.execd_preinstall('turnip')
36@@ -99,6 +109,7 @@
37 source='turnip-logrotate.j2',
38 target='/etc/logrotate.d/turnip',
39 perms=0o644),
40+ render_rsync_template(config),
41 ],
42 'start': [
43 actions.turnip_service_restart,
44
45=== added file 'templates/turnip-rsync.j2'
46--- templates/turnip-rsync.j2 1970-01-01 00:00:00 +0000
47+++ templates/turnip-rsync.j2 2015-05-07 16:04:22 +0000
48@@ -0,0 +1,8 @@
49+
50+[turnip-logs]
51+ path = {{ base_dir }}/logs
52+ comment = Turnip Logs
53+ list = false
54+ read only = true
55+ hosts allow = {{ log_hosts_allow }}
56+

Subscribers

People subscribed via source and target branches

to all changes: