Merge lp:~hopem/charms/trusty/keystone/fix-auth-settings into lp:~openstack-charmers-archive/charms/trusty/keystone/next

Proposed by Edward Hope-Morley
Status: Merged
Merged at revision: 136
Proposed branch: lp:~hopem/charms/trusty/keystone/fix-auth-settings
Merge into: lp:~openstack-charmers-archive/charms/trusty/keystone/next
Diff against target: 103 lines (+12/-24)
2 files modified
hooks/keystone_utils.py (+4/-12)
unit_tests/test_keystone_utils.py (+8/-12)
To merge this branch: bzr merge lp:~hopem/charms/trusty/keystone/fix-auth-settings
Reviewer Review Type Date Requested Status
Liam Young (community) Approve
Review via email: mp+254520@code.launchpad.net
To post a comment you must log in.
Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #2967 keystone-next for hopem mp254520
    LINT OK: passed

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

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

charm_unit_test #2758 keystone-next for hopem mp254520
    UNIT OK: passed

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

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/keystone_utils.py'
2--- hooks/keystone_utils.py 2015-03-27 00:27:22 +0000
3+++ hooks/keystone_utils.py 2015-03-29 23:11:23 +0000
4@@ -1247,12 +1247,9 @@
5 # Some backend services advertise no endpoint but require a
6 # hook execution to update auth strategy.
7 relation_data = {}
8- rel_only_data = {}
9 # Check if clustered and use vip + haproxy ports if so
10- # NOTE(hopem): don't put these on peer relation because racey
11- # leader election causes cluster relation to spin)
12- rel_only_data["auth_host"] = resolve_address(ADMIN)
13- rel_only_data["service_host"] = resolve_address(PUBLIC)
14+ relation_data["auth_host"] = resolve_address(ADMIN)
15+ relation_data["service_host"] = resolve_address(PUBLIC)
16
17 relation_data["auth_protocol"] = protocol
18 relation_data["service_protocol"] = protocol
19@@ -1276,7 +1273,6 @@
20 log("Creating requested role: %s" % role)
21 create_role(role)
22
23- relation_set(relation_id=relation_id, **rel_only_data)
24 peer_store_and_set(relation_id=relation_id, **relation_data)
25 return
26 else:
27@@ -1381,14 +1377,11 @@
28 # service credentials
29 service_tenant = config('service-tenant')
30
31- # NOTE(hopem): don't put these on peer relation because racey
32- # leader election causes cluster relation to spin)
33- rel_only_data = {"auth_host": resolve_address(ADMIN),
34- "service_host": resolve_address(PUBLIC)}
35-
36 # NOTE(dosaboy): we use __null__ to represent settings that are to be
37 # routed to relations via the cluster relation and set to None.
38 relation_data = {
39+ "auth_host": resolve_address(ADMIN),
40+ "service_host": resolve_address(PUBLIC),
41 "admin_token": token,
42 "service_port": config("service-port"),
43 "auth_port": config("admin-port"),
44@@ -1423,7 +1416,6 @@
45 relation_data['ca_cert'] = b64encode(ca_bundle)
46 relation_data['https_keystone'] = 'True'
47
48- relation_set(relation_id=relation_id, **rel_only_data)
49 # NOTE(dosaboy): '__null__' settings are for peer relation only so that
50 # settings can flushed so we filter them out for non-peer relation.
51 filtered = filter_null(relation_data)
52
53=== modified file 'unit_tests/test_keystone_utils.py'
54--- unit_tests/test_keystone_utils.py 2015-03-26 23:13:15 +0000
55+++ unit_tests/test_keystone_utils.py 2015-03-29 23:11:23 +0000
56@@ -179,17 +179,15 @@
57 self.assertTrue(self.https.called)
58 self.assertTrue(self.create_role.called)
59
60- rel_only_data = {'auth_host': '10.10.10.10',
61- 'service_host': '10.10.10.10'}
62- relation_data = {'auth_protocol': 'https',
63+ relation_data = {'auth_host': '10.10.10.10',
64+ 'service_host': '10.10.10.10',
65+ 'auth_protocol': 'https',
66 'service_protocol': 'https',
67 'auth_port': 80,
68 'service_port': 81,
69 'https_keystone': 'True',
70 'ca_cert': 'certificate',
71 'region': 'RegionOne'}
72- self.relation_set.assert_called_with(relation_id=relation_id,
73- **rel_only_data)
74 self.peer_store_and_set.assert_called_with(relation_id=relation_id,
75 **relation_data)
76
77@@ -237,9 +235,8 @@
78 self.grant_role.assert_called_with('keystone', 'admin', 'tenant')
79 self.create_role.assert_called_with('role1', 'keystone', 'tenant')
80
81- rel_only_data = {'auth_host': '10.0.0.3',
82- 'service_host': '10.0.0.3'}
83- relation_data = {'admin_token': 'token', 'service_port': 81,
84+ relation_data = {'auth_host': '10.0.0.3', 'service_host': '10.0.0.3',
85+ 'admin_token': 'token', 'service_port': 81,
86 'auth_port': 80, 'service_username': 'keystone',
87 'service_password': 'password',
88 'service_tenant': 'tenant',
89@@ -256,11 +253,10 @@
90 else:
91 filtered[k] = v
92
93- call1 = call(relation_id=relation_id, **rel_only_data)
94- call2 = call(relation_id=relation_id, **filtered)
95- call3 = call(relation_id='cluster/0', **relation_data)
96+ call1 = call(relation_id=relation_id, **filtered)
97+ call2 = call(relation_id='cluster/0', **relation_data)
98 self.assertTrue(self.relation_set.called)
99- self.relation_set.assert_has_calls([call1, call2, call3])
100+ self.relation_set.assert_has_calls([call1, call2])
101
102 @patch.object(utils, 'ensure_valid_service')
103 @patch.object(utils, 'add_endpoint')

Subscribers

People subscribed via source and target branches