Merge lp:~james-page/charms/trusty/cinder/lp1521604 into lp:~openstack-charmers-archive/charms/trusty/cinder/next

Proposed by James Page
Status: Merged
Merged at revision: 140
Proposed branch: lp:~james-page/charms/trusty/cinder/lp1521604
Merge into: lp:~openstack-charmers-archive/charms/trusty/cinder/next
Diff against target: 98 lines (+44/-2)
4 files modified
hooks/cinder_hooks.py (+6/-2)
hooks/cinder_utils.py (+9/-0)
unit_tests/test_cinder_hooks.py (+8/-0)
unit_tests/test_cinder_utils.py (+21/-0)
To merge this branch: bzr merge lp:~james-page/charms/trusty/cinder/lp1521604
Reviewer Review Type Date Requested Status
Liam Young (community) Approve
Review via email: mp+281799@code.launchpad.net

This proposal supersedes a proposal from 2016-01-06.

Description of the change

Drop requirement for identity service unless api service is enabled.

To post a comment you must log in.
141. By James Page

Also avoid overwrite of actual endpoint information for service instances where api service is not enabled

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

charm_lint_check #16668 cinder-next for james-page mp281799
    LINT FAIL: lint-test failed

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

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

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

charm_unit_test #15565 cinder-next for james-page mp281799
    UNIT OK: passed

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

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

charm_amulet_test #8544 cinder-next for james-page mp281799
    AMULET OK: passed

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

142. By James Page

Tidy lint

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

charm_lint_check #16726 cinder-next for james-page mp281799
    LINT OK: passed

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

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

charm_unit_test #15620 cinder-next for james-page mp281799
    UNIT OK: passed

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

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

charm_amulet_test #8551 cinder-next for james-page mp281799
    AMULET OK: passed

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

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

LGTM, approved

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-10-08 14:28:50 +0000
+++ hooks/cinder_hooks.py 2016-01-07 09:37:49 +0000
@@ -27,7 +27,7 @@
27 setup_ipv6,27 setup_ipv6,
28 check_db_initialised,28 check_db_initialised,
29 filesystem_mounted,29 filesystem_mounted,
30 REQUIRED_INTERFACES,30 required_interfaces,
31 check_optional_relations,31 check_optional_relations,
32)32)
3333
@@ -270,6 +270,10 @@
270270
271@hooks.hook('identity-service-relation-joined')271@hooks.hook('identity-service-relation-joined')
272def identity_joined(rid=None):272def identity_joined(rid=None):
273 if not service_enabled('api'):
274 juju_log('api service not enabled; skipping endpoint registration')
275 return
276
273 public_url = '{}:{}/v1/$(tenant_id)s'.format(277 public_url = '{}:{}/v1/$(tenant_id)s'.format(
274 canonical_url(CONFIGS, PUBLIC),278 canonical_url(CONFIGS, PUBLIC),
275 config('api-listening-port')279 config('api-listening-port')
@@ -553,5 +557,5 @@
553 hooks.execute(sys.argv)557 hooks.execute(sys.argv)
554 except UnregisteredHookError as e:558 except UnregisteredHookError as e:
555 juju_log('Unknown hook {} - skipping.'.format(e))559 juju_log('Unknown hook {} - skipping.'.format(e))
556 set_os_workload_status(CONFIGS, REQUIRED_INTERFACES,560 set_os_workload_status(CONFIGS, required_interfaces(),
557 charm_func=check_optional_relations)561 charm_func=check_optional_relations)
558562
=== modified file 'hooks/cinder_utils.py'
--- hooks/cinder_utils.py 2015-10-08 14:28:50 +0000
+++ hooks/cinder_utils.py 2016-01-07 09:37:49 +0000
@@ -168,6 +168,15 @@
168}168}
169169
170170
171def required_interfaces():
172 '''Provide the required charm interfaces based on configured roles.'''
173 _interfaces = copy(REQUIRED_INTERFACES)
174 if not service_enabled('api'):
175 # drop requirement for identity interface
176 _interfaces.pop('identity')
177 return _interfaces
178
179
171def ceph_config_file():180def ceph_config_file():
172 return CHARM_CEPH_CONF.format(service_name())181 return CHARM_CEPH_CONF.format(service_name())
173182
174183
=== modified file 'unit_tests/test_cinder_hooks.py'
--- unit_tests/test_cinder_hooks.py 2015-10-29 04:46:01 +0000
+++ unit_tests/test_cinder_hooks.py 2016-01-07 09:37:49 +0000
@@ -485,6 +485,14 @@
485 }485 }
486 self.relation_set.assert_called_with(**expected)486 self.relation_set.assert_called_with(**expected)
487487
488 def test_identity_service_joined_no_api(self):
489 'endpoint registration is skipped if api service is not enabled'
490 self.config.side_effect = self.test_config.get
491 self.service_enabled.return_value = False
492 hooks.hooks.execute(['hooks/identity-service-relation-joined'])
493 self.assertFalse(self.relation_set.called)
494 self.service_enabled.assert_called_with('api')
495
488 @patch.object(hooks, 'canonical_url')496 @patch.object(hooks, 'canonical_url')
489 def test_identity_service_joined_icehouse(self, _canonical_url):497 def test_identity_service_joined_icehouse(self, _canonical_url):
490 'It properly requests unclustered endpoint via identity-service'498 'It properly requests unclustered endpoint via identity-service'
491499
=== modified file 'unit_tests/test_cinder_utils.py'
--- unit_tests/test_cinder_utils.py 2015-10-01 13:38:52 +0000
+++ unit_tests/test_cinder_utils.py 2016-01-07 09:37:49 +0000
@@ -805,3 +805,24 @@
805 volume_group = "test"805 volume_group = "test"
806 cinder_utils.remove_lvm_volume_group(volume_group)806 cinder_utils.remove_lvm_volume_group(volume_group)
807 _check.assert_called_with(['vgremove', '--force', volume_group])807 _check.assert_called_with(['vgremove', '--force', volume_group])
808
809 def test_required_interfaces_api(self):
810 '''identity-service interface required for api service'''
811 expected = {
812 'database': ['shared-db', 'pgsql-db'],
813 'messaging': ['amqp'],
814 'identity': ['identity-service'],
815 }
816 self.assertEqual(cinder_utils.required_interfaces(), expected)
817
818 def test_required_interfaces_no_api(self):
819 '''
820 identity-service interface not required for volume
821 or scheduler service
822 '''
823 self.test_config.set('enabled-services', 'volume,scheduler')
824 expected = {
825 'database': ['shared-db', 'pgsql-db'],
826 'messaging': ['amqp'],
827 }
828 self.assertEqual(cinder_utils.required_interfaces(), expected)

Subscribers

People subscribed via source and target branches