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
=== modified file 'config.yaml'
--- config.yaml 2015-04-27 01:59:44 +0000
+++ config.yaml 2015-05-07 16:04:22 +0000
@@ -102,6 +102,10 @@
102 description: |102 description: |
103 A list of repository URLs to run end-to-end checks on. Multiple103 A list of repository URLs to run end-to-end checks on. Multiple
104 entries should be separated by spaces.104 entries should be separated by spaces.
105 log_hosts_allow:
106 type: string
107 default: ""
108 description: Hosts that should be allowed to rsync logs.
105109
106 # apt configuration used by charmhelpers.110 # apt configuration used by charmhelpers.
107 install_sources:111 install_sources:
108112
=== modified file 'hooks/services.py'
--- hooks/services.py 2015-04-27 01:59:44 +0000
+++ hooks/services.py 2015-05-07 16:04:22 +0000
@@ -19,6 +19,16 @@
19 group=config['code_group'])19 group=config['code_group'])
2020
2121
22def render_rsync_template(config):
23 if config['log_hosts_allow']:
24 return helpers.render_template(
25 source='turnip-rsync.j2',
26 target='/etc/rsyncd.d/010-turnip',
27 perms=0o644)
28 else:
29 return lambda _: None
30
31
22def manage():32def manage():
23 if hookenv.hook_name() in ('install', 'upgrade-charm'):33 if hookenv.hook_name() in ('install', 'upgrade-charm'):
24 actions.execd_preinstall('turnip')34 actions.execd_preinstall('turnip')
@@ -99,6 +109,7 @@
99 source='turnip-logrotate.j2',109 source='turnip-logrotate.j2',
100 target='/etc/logrotate.d/turnip',110 target='/etc/logrotate.d/turnip',
101 perms=0o644),111 perms=0o644),
112 render_rsync_template(config),
102 ],113 ],
103 'start': [114 'start': [
104 actions.turnip_service_restart,115 actions.turnip_service_restart,
105116
=== added file 'templates/turnip-rsync.j2'
--- templates/turnip-rsync.j2 1970-01-01 00:00:00 +0000
+++ templates/turnip-rsync.j2 2015-05-07 16:04:22 +0000
@@ -0,0 +1,8 @@
1
2[turnip-logs]
3 path = {{ base_dir }}/logs
4 comment = Turnip Logs
5 list = false
6 read only = true
7 hosts allow = {{ log_hosts_allow }}
8

Subscribers

People subscribed via source and target branches

to all changes: