Merge lp:~ionutbalutoiu/charms/trusty/swift-proxy/next into lp:~openstack-charmers-archive/charms/trusty/swift-proxy/next

Proposed by Ionut-Madalin Balutoiu on 2015-10-30
Status: Merged
Merged at revision: 123
Proposed branch: lp:~ionutbalutoiu/charms/trusty/swift-proxy/next
Merge into: lp:~openstack-charmers-archive/charms/trusty/swift-proxy/next
Diff against target: 30 lines (+13/-0)
1 file modified
hooks/swift_hooks.py (+13/-0)
To merge this branch: bzr merge lp:~ionutbalutoiu/charms/trusty/swift-proxy/next
Reviewer Review Type Date Requested Status
David Ames 2015-10-30 Approve on 2015-11-02
Review via email: mp+276218@code.launchpad.net

Description of the Change

Adds object-store-relation-joined hook.
Variable 'swift-url' is useful when generating temporary URLs with Swift.

Needed for OpenStack Ironic charm (http://bazaar.launchpad.net/~cloudbaseit/charms/trusty/ironic/trunk/view/head:/hooks/ironic_context.py#L99), but might also be generally useful.

To post a comment you must log in.

charm_unit_test #11994 swift-proxy-next for ionutbalutoiu mp276218
    UNIT OK: passed

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

charm_lint_check #12919 swift-proxy-next for ionutbalutoiu mp276218
    LINT OK: passed

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

charm_amulet_test #7662 swift-proxy-next for ionutbalutoiu mp276218
    AMULET FAIL: amulet-test failed

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

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

David Ames (thedac) wrote :

Hello and thanks for submitting.

The amulet failure is:

2015-10-30 21:17:20 INFO config-changed Traceback (most recent call last):
2015-10-30 21:17:20 INFO config-changed File "/var/lib/juju/agents/unit-swift-proxy-0/charm/hooks/config-changed", line 550, in <module>
2015-10-30 21:17:20 INFO config-changed main()
2015-10-30 21:17:20 INFO config-changed File "/var/lib/juju/agents/unit-swift-proxy-0/charm/hooks/config-changed", line 543, in main
2015-10-30 21:17:20 INFO config-changed hooks.execute(sys.argv)
2015-10-30 21:17:20 INFO config-changed File "/var/lib/juju/agents/unit-swift-proxy-0/charm/hooks/charmhelpers/core/hookenv.py", line 704, in execute
2015-10-30 21:17:20 INFO config-changed self._hooks[hook_name]()
2015-10-30 21:17:20 INFO config-changed File "/var/lib/juju/agents/unit-swift-proxy-0/charm/hooks/charmhelpers/core/host.py", line 393, in wrapped_f
2015-10-30 21:17:20 INFO config-changed f(*args, **kwargs)
2015-10-30 21:17:20 INFO config-changed File "/var/lib/juju/agents/unit-swift-proxy-0/charm/hooks/config-changed", line 156, in config_changed
2015-10-30 21:17:20 INFO config-changed object_store_joined(relid=r_id)
2015-10-30 21:17:20 INFO config-changed TypeError: object_store_joined() got an unexpected keyword argument 'relid'
2015-10-30 21:17:20 ERROR juju.worker.uniter.operation runhook.go:103 hook "config-changed" failed: exit status 1

relid vs relation_id

+ for r_id in relation_ids('object-store'):
+ object_store_joined(relid=r_id)

+@hooks.hook('object-store-relation-joined')
+def object_store_joined(relation_id=None):

review: Needs Fixing

charm_lint_check #12929 swift-proxy-next for ionutbalutoiu mp276218
    LINT OK: passed

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

charm_unit_test #12005 swift-proxy-next for ionutbalutoiu mp276218
    UNIT OK: passed

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

charm_amulet_test #7672 swift-proxy-next for ionutbalutoiu mp276218
    AMULET OK: passed

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

David Ames (thedac) wrote :

Ionut-Madalin,

This looks good. I tested manually. Will merge.

Thanks again for participating in the charm community.

review: Approve
123. By David Ames on 2015-11-02

[ionutbalutoiu, r=thedac] Variable 'swift-url' is useful when generating temporary URLs with Swift.
Adds object-store-relation-joined hook.
Needed for OpenStack Ironic charm (http://bazaar.launchpad.net/~cloudbaseit/charms/trusty/ironic/trunk/view/head:/hooks/ironic_context.py#L99), but might also be generally useful.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/swift_hooks.py'
2--- hooks/swift_hooks.py 2015-10-13 21:29:27 +0000
3+++ hooks/swift_hooks.py 2015-10-30 22:17:34 +0000
4@@ -152,6 +152,9 @@
5 for r_id in relation_ids('identity-service'):
6 keystone_joined(relid=r_id)
7
8+ for r_id in relation_ids('object-store'):
9+ object_store_joined(relation_id=r_id)
10+
11
12 @hooks.hook('identity-service-relation-joined')
13 def keystone_joined(relid=None):
14@@ -256,6 +259,16 @@
15 CONFIGS.write_all()
16
17
18+@hooks.hook('object-store-relation-joined')
19+def object_store_joined(relation_id=None):
20+ relation_data = {
21+ 'swift-url':
22+ "{}:{}".format(canonical_url(CONFIGS, INTERNAL), config('bind-port'))
23+ }
24+
25+ relation_set(relation_id=relation_id, **relation_data)
26+
27+
28 @hooks.hook('cluster-relation-joined')
29 def cluster_joined(relation_id=None):
30 for addr_type in ADDRESS_TYPES:

Subscribers

People subscribed via source and target branches