Merge lp:~james-page/charms/trusty/cinder/fixup-allowed-unit-migration into lp:~openstack-charmers-archive/charms/trusty/cinder/next

Proposed by James Page
Status: Merged
Merged at revision: 89
Proposed branch: lp:~james-page/charms/trusty/cinder/fixup-allowed-unit-migration
Merge into: lp:~openstack-charmers-archive/charms/trusty/cinder/next
Diff against target: 41 lines (+15/-5)
2 files modified
hooks/cinder_hooks.py (+6/-5)
unit_tests/test_cinder_hooks.py (+9/-0)
To merge this branch: bzr merge lp:~james-page/charms/trusty/cinder/fixup-allowed-unit-migration
Reviewer Review Type Date Requested Status
Liam Young (community) Approve
Adam Collard (community) Approve
Review via email: mp+256953@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Adam Collard (adam-collard) wrote :

2 minor comments inline

review: Approve
90. By James Page

Fixup based on feedback

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

charm_lint_check #3687 cinder-next for james-page mp256953
    LINT OK: passed

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

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

charm_unit_test #3474 cinder-next for james-page mp256953
    UNIT OK: passed

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

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

charm_amulet_test #3482 cinder-next for james-page mp256953
    AMULET OK: passed

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

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/cinder_hooks.py'
2--- hooks/cinder_hooks.py 2015-04-02 12:13:45 +0000
3+++ hooks/cinder_hooks.py 2015-04-21 15:20:32 +0000
4@@ -195,11 +195,12 @@
5 # acl entry has been added. So, if the db supports passing a list of
6 # permitted units then check if we're in the list.
7 allowed_units = relation_get('allowed_units')
8- if allowed_units and local_unit() not in allowed_units.split():
9- juju_log('Allowed_units list provided and this unit not present')
10- return
11- juju_log('Cluster leader, performing db sync')
12- migrate_database()
13+ if allowed_units and local_unit() in allowed_units.split():
14+ juju_log('Cluster leader, performing db sync')
15+ migrate_database()
16+ else:
17+ juju_log('allowed_units either not presented, or local unit '
18+ 'not in acl list: %s' % repr(allowed_units))
19
20
21 @hooks.hook('pgsql-db-relation-changed')
22
23=== modified file 'unit_tests/test_cinder_hooks.py'
24--- unit_tests/test_cinder_hooks.py 2015-04-02 12:13:45 +0000
25+++ unit_tests/test_cinder_hooks.py 2015-04-21 15:20:32 +0000
26@@ -244,6 +244,15 @@
27 hooks.hooks.execute(['hooks/shared-db-relation-changed'])
28 self.assertFalse(self.migrate_database.called)
29
30+ def test_db_changed_relation_db_missing_acls(self):
31+ 'No database migration is attempted when ACL list is not present'
32+ self.relation_get.return_value = None
33+ self.local_unit.return_value = 'cinder/0'
34+ self.CONFIGS.complete_contexts.return_value = ['shared-db']
35+ self.eligible_leader.return_value = True
36+ hooks.hooks.execute(['hooks/shared-db-relation-changed'])
37+ self.assertFalse(self.migrate_database.called)
38+
39 def test_pgsql_db_changed_relation_incomplete(self):
40 'It does not write out cinder.conf with incomplete pgsql-db rel'
41 hooks.hooks.execute(['hooks/pgsql-db-relation-changed'])

Subscribers

People subscribed via source and target branches