Merge lp:~cbjchen/charms/trusty/glance/remove_stale_key into lp:~openstack-charmers-archive/charms/trusty/glance/next

Proposed by Liang Chen
Status: Merged
Merged at revision: 97
Proposed branch: lp:~cbjchen/charms/trusty/glance/remove_stale_key
Merge into: lp:~openstack-charmers-archive/charms/trusty/glance/next
Diff against target: 61 lines (+17/-2)
2 files modified
hooks/glance_relations.py (+9/-2)
unit_tests/test_glance_relations.py (+8/-0)
To merge this branch: bzr merge lp:~cbjchen/charms/trusty/glance/remove_stale_key
Reviewer Review Type Date Requested Status
Edward Hope-Morley Approve
OpenStack Charmers Pending
Review via email: mp+248164@code.launchpad.net

Description of the change

Clean up the keyring for glance after ceph service is destroyed and re-created like below,

1. break relation
2. destroy service
3. deploy new ceph service
4. add relation back

If old key exists, ensure_ceph_keyring will not store the newly retrieved key from ceph.

To post a comment you must log in.
Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #1454 glance-next for cbjchen mp248164
    LINT FAIL: lint-test failed

LINT Results (max last 2 lines):
  hooks/glance_relations.py:272:1: W293 blank line contains whitespace
  make: *** [lint] Error 1

Full lint test output: http://paste.ubuntu.com/9962752/
Build: http://10.245.162.77:8080/job/charm_lint_check/1454/

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

charm_unit_test #1407 glance-next for cbjchen mp248164
    UNIT OK: passed

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

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

charm_amulet_test #1572 glance-next for cbjchen mp248164
    AMULET OK: passed

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

97. By Liang Chen <email address hidden>

Clean up stale ceph keyring

[cbjchen,r=]
Clean up the keyring after ceph relation is broken. So when next
time ceph relation is joined, ensure_ceph_keyring will not ignore
the new key because of the existance of the old one.

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

charm_lint_check #1456 glance-next for cbjchen mp248164
    LINT OK: passed

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

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

charm_unit_test #1409 glance-next for cbjchen mp248164
    UNIT OK: passed

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

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

charm_amulet_test #1574 glance-next for cbjchen mp248164
    AMULET OK: passed

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

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

LGTM +1

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

I've deployed this along with the other ceph client changes and it all seems good. Thanks Liang. +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/glance_relations.py'
2--- hooks/glance_relations.py 2015-01-22 16:26:28 +0000
3+++ hooks/glance_relations.py 2015-01-30 22:43:09 +0000
4@@ -63,6 +63,7 @@
5 ensure_ceph_keyring,
6 CephBrokerRq,
7 CephBrokerRsp,
8+ delete_keyring,
9 )
10 from charmhelpers.payload.execd import (
11 execd_preinstall
12@@ -263,6 +264,13 @@
13 juju_log("Request(s) sent to Ceph broker (rid=%s)" % (rid))
14
15
16+@hooks.hook('ceph-relation-broken')
17+def ceph_broken():
18+ service = service_name()
19+ delete_keyring(service=service)
20+ CONFIGS.write_all()
21+
22+
23 @hooks.hook('identity-service-relation-joined')
24 def keystone_joined(relation_id=None):
25 public_url = '{}:9292'.format(canonical_url(CONFIGS, PUBLIC))
26@@ -433,8 +441,7 @@
27 [image_service_joined(rid) for rid in relation_ids('image-service')]
28
29
30-@hooks.hook('ceph-relation-broken',
31- 'identity-service-relation-broken',
32+@hooks.hook('identity-service-relation-broken',
33 'object-store-relation-broken',
34 'shared-db-relation-broken',
35 'pgsql-db-relation-broken')
36
37=== modified file 'unit_tests/test_glance_relations.py'
38--- unit_tests/test_glance_relations.py 2015-01-22 16:55:57 +0000
39+++ unit_tests/test_glance_relations.py 2015-01-30 22:43:09 +0000
40@@ -64,6 +64,7 @@
41 'get_iface_for_address',
42 'get_ipv6_addr',
43 'sync_db_with_multi_ipv6_addresses',
44+ 'delete_keyring',
45 ]
46
47
48@@ -381,6 +382,13 @@
49 call(self.ceph_config_file())],
50 configs.write.call_args_list)
51
52+ @patch.object(relations, 'CONFIGS')
53+ def test_ceph_broken(self, configs):
54+ self.service_name.return_value = 'glance'
55+ relations.ceph_broken()
56+ self.delete_keyring.assert_called_with(service='glance')
57+ self.assertTrue(configs.write_all.called)
58+
59 def test_keystone_joined(self):
60 self.canonical_url.return_value = 'http://glancehost'
61 relations.keystone_joined()

Subscribers

People subscribed via source and target branches