Merge lp:~hopem/charms/trusty/swift-storage/support-rsync-acl into lp:~openstack-charmers-archive/charms/trusty/swift-storage/next

Proposed by Edward Hope-Morley
Status: Merged
Merged at revision: 96
Proposed branch: lp:~hopem/charms/trusty/swift-storage/support-rsync-acl
Merge into: lp:~openstack-charmers-archive/charms/trusty/swift-storage/next
Diff against target: 82 lines (+28/-6)
3 files modified
hooks/swift_storage_hooks.py (+3/-0)
lib/swift_storage_context.py (+16/-5)
templates/050-swift-storage.conf (+9/-1)
To merge this branch: bzr merge lp:~hopem/charms/trusty/swift-storage/support-rsync-acl
Reviewer Review Type Date Requested Status
Liam Young (community) Approve
James Page Approve
Review via email: mp+278424@code.launchpad.net

This proposal supersedes a proposal from 2015-03-15.

To post a comment you must log in.
Revision history for this message
Edward Hope-Morley (hopem) wrote : Posted in a previous version of this proposal

FTR this is NOT merged to /next, not sure why LP marked it as such.

Revision history for this message
Edward Hope-Morley (hopem) wrote :

Before:
    ubuntu@dev:~$ juju ssh swift-storage-z1/0 "sudo grep 'hosts allow' /etc/rsync-juju.d/050-swift-storage.conf"
    ubuntu@dev:~$
    ubuntu@dev:~$ tmp=`mktemp -d`; rsync -var $tmp swift@`juju-deployer -f swift-storage-z1`::object; rm -rf $tmp
    2015-11-24 12:07:09 Service: swift-storage-z1 address: 10.5.16.232
    sending incremental file list
    tmp.wcuTXHLGnG/

    sent 84 bytes received 20 bytes 208.00 bytes/sec
    total size is 0 speedup is 0.00

After:
    ubuntu@dev:~$ juju ssh swift-storage-z1/0 "sudo grep 'hosts allow' /etc/rsync-juju.d/050-swift-storage.conf"
    hosts allow = 10.5.16.242 10.5.16.243 10.5.16.244
    hosts allow = 10.5.16.242 10.5.16.243 10.5.16.244
    hosts allow = 10.5.16.242 10.5.16.243 10.5.16.244

    ubuntu@dev:~$ tmp=`mktemp -d`; rsync -var $tmp swift@`juju-deployer -f swift-storage-z1`::object; rm -rf $tmp
    2015-11-24 13:02:58 Service: swift-storage-z1 address: 10.5.16.242
    @ERROR: access denied to object from UNKNOWN (10.5.0.3)
    rsync error: error starting client-server protocol (code 5) at main.c(1653) [sender=3.1.0]

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #14309 swift-storage-next for hopem mp278424
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/14309/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #13336 swift-storage-next for hopem mp278424
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/13336/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #8022 swift-storage-next for hopem mp278424
    AMULET FAIL: amulet-test failed

AMULET Results (max last 2 lines):
make: *** [functional_test] Error 124
ERROR:root:Make target returned non-zero.

Full amulet test output: http://paste.ubuntu.com/13492696/
Build: http://10.245.162.77:8080/job/charm_amulet_test/8022/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #8023 swift-storage-next for hopem mp278424
    AMULET FAIL: amulet-test failed

AMULET Results (max last 2 lines):
make: *** [functional_test] Error 124
ERROR:root:Make target returned non-zero.

Full amulet test output: http://paste.ubuntu.com/13492785/
Build: http://10.245.162.77:8080/job/charm_amulet_test/8023/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #8025 swift-storage-next for hopem mp278424
    AMULET OK: passed

Build: http://10.245.162.77:8080/job/charm_amulet_test/8025/

Revision history for this message
James Page (james-page) :
review: Approve
97. By Edward Hope-Morley

fix minor nit in template

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #14475 swift-storage-next for hopem mp278424
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/14475/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #13494 swift-storage-next for hopem mp278424
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/13494/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #8038 swift-storage-next for hopem mp278424
    AMULET OK: passed

Build: http://10.245.162.77:8080/job/charm_amulet_test/8038/

Revision history for this message
Liam Young (gnuoy) wrote :

Approve

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/swift_storage_hooks.py'
2--- hooks/swift_storage_hooks.py 2015-10-15 19:05:42 +0000
3+++ hooks/swift_storage_hooks.py 2015-11-27 09:29:06 +0000
4@@ -123,7 +123,10 @@
5 if '' in [rings_url, swift_hash] or None in [rings_url, swift_hash]:
6 log('swift_storage_relation_changed: Peer not ready?')
7 sys.exit(0)
8+
9+ CONFIGS.write('/etc/rsync-juju.d/050-swift-storage.conf')
10 CONFIGS.write('/etc/swift/swift.conf')
11+
12 fetch_swift_rings(rings_url)
13
14
15
16=== modified file 'lib/swift_storage_context.py'
17--- lib/swift_storage_context.py 2015-07-17 09:57:19 +0000
18+++ lib/swift_storage_context.py 2015-11-27 09:29:06 +0000
19@@ -54,15 +54,26 @@
20 out.write(_m.sub('RSYNC_ENABLE=true', default))
21
22 def __call__(self):
23+ ctxt = {}
24 if config('prefer-ipv6'):
25- local_ip = '%s' % get_ipv6_addr()[0]
26+ ctxt['local_ip'] = '%s' % get_ipv6_addr()[0]
27 else:
28- local_ip = unit_private_ip()
29+ ctxt['local_ip'] = unit_private_ip()
30+
31+ timestamps = []
32+ for rid in relation_ids('swift-storage'):
33+ for unit in related_units(rid):
34+ settings = relation_get(unit=unit, rid=rid)
35+ ts = settings.get('timestamp')
36+ allowed_hosts = settings.get('rsync_allowed_hosts')
37+ if allowed_hosts and ts:
38+ if not timestamps or ts > max(timestamps):
39+ ctxt['allowed_hosts'] = allowed_hosts
40+
41+ timestamps.append(ts)
42
43 self.enable_rsyncd()
44- return {
45- 'local_ip': local_ip
46- }
47+ return ctxt
48
49
50 class SwiftStorageServerContext(OSContextGenerator):
51
52=== modified file 'templates/050-swift-storage.conf'
53--- templates/050-swift-storage.conf 2014-11-06 07:38:43 +0000
54+++ templates/050-swift-storage.conf 2015-11-27 09:29:06 +0000
55@@ -5,6 +5,9 @@
56 path = /srv/node/
57 read only = false
58 lock file = /var/lock/account.lock
59+{% if allowed_hosts -%}
60+hosts allow = {{ allowed_hosts }}
61+{% endif %}
62
63 [container]
64 uid = swift
65@@ -13,6 +16,9 @@
66 path = /srv/node/
67 read only = false
68 lock file = /var/lock/container.lock
69+{% if allowed_hosts -%}
70+hosts allow = {{ allowed_hosts }}
71+{% endif %}
72
73 [object]
74 uid = swift
75@@ -21,4 +27,6 @@
76 path = /srv/node/
77 read only = false
78 lock file = /var/lock/object.lock
79-
80+{% if allowed_hosts -%}
81+hosts allow = {{ allowed_hosts }}
82+{% endif %}

Subscribers

People subscribed via source and target branches