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
=== modified file 'hooks/cinder_hooks.py'
--- hooks/cinder_hooks.py 2015-04-02 12:13:45 +0000
+++ hooks/cinder_hooks.py 2015-04-21 15:20:32 +0000
@@ -195,11 +195,12 @@
195 # acl entry has been added. So, if the db supports passing a list of195 # acl entry has been added. So, if the db supports passing a list of
196 # permitted units then check if we're in the list.196 # permitted units then check if we're in the list.
197 allowed_units = relation_get('allowed_units')197 allowed_units = relation_get('allowed_units')
198 if allowed_units and local_unit() not in allowed_units.split():198 if allowed_units and local_unit() in allowed_units.split():
199 juju_log('Allowed_units list provided and this unit not present')199 juju_log('Cluster leader, performing db sync')
200 return200 migrate_database()
201 juju_log('Cluster leader, performing db sync')201 else:
202 migrate_database()202 juju_log('allowed_units either not presented, or local unit '
203 'not in acl list: %s' % repr(allowed_units))
203204
204205
205@hooks.hook('pgsql-db-relation-changed')206@hooks.hook('pgsql-db-relation-changed')
206207
=== modified file 'unit_tests/test_cinder_hooks.py'
--- unit_tests/test_cinder_hooks.py 2015-04-02 12:13:45 +0000
+++ unit_tests/test_cinder_hooks.py 2015-04-21 15:20:32 +0000
@@ -244,6 +244,15 @@
244 hooks.hooks.execute(['hooks/shared-db-relation-changed'])244 hooks.hooks.execute(['hooks/shared-db-relation-changed'])
245 self.assertFalse(self.migrate_database.called)245 self.assertFalse(self.migrate_database.called)
246246
247 def test_db_changed_relation_db_missing_acls(self):
248 'No database migration is attempted when ACL list is not present'
249 self.relation_get.return_value = None
250 self.local_unit.return_value = 'cinder/0'
251 self.CONFIGS.complete_contexts.return_value = ['shared-db']
252 self.eligible_leader.return_value = True
253 hooks.hooks.execute(['hooks/shared-db-relation-changed'])
254 self.assertFalse(self.migrate_database.called)
255
247 def test_pgsql_db_changed_relation_incomplete(self):256 def test_pgsql_db_changed_relation_incomplete(self):
248 'It does not write out cinder.conf with incomplete pgsql-db rel'257 'It does not write out cinder.conf with incomplete pgsql-db rel'
249 hooks.hooks.execute(['hooks/pgsql-db-relation-changed'])258 hooks.hooks.execute(['hooks/pgsql-db-relation-changed'])

Subscribers

People subscribed via source and target branches