Merge lp:~james-page/charms/precise/openstack-dashboard/fixup-decode into lp:~charmers/charms/precise/openstack-dashboard/trunk

Proposed by James Page
Status: Merged
Merged at revision: 24
Proposed branch: lp:~james-page/charms/precise/openstack-dashboard/fixup-decode
Merge into: lp:~charmers/charms/precise/openstack-dashboard/trunk
Diff against target: 106 lines (+15/-3)
5 files modified
hooks/horizon_hooks.py (+2/-1)
unit_tests/test_horizon_contexts.py (+2/-1)
unit_tests/test_horizon_hooks.py (+7/-1)
unit_tests/test_horizon_utils.py (+1/-0)
unit_tests/test_utils.py (+3/-0)
To merge this branch: bzr merge lp:~james-page/charms/precise/openstack-dashboard/fixup-decode
Reviewer Review Type Date Requested Status
Ante Karamatić (community) Approve
Jonathan Davies (community) Approve
Marco Ceppi (community) Abstain
OpenStack Charmers Pending
Review via email: mp+202638@code.launchpad.net

Description of the change

Ensure ca_cert is decoded before writing to disk.

Otherwise dashboard can't access keystone signed SSL services.

To post a comment you must log in.
Revision history for this message
Jonathan Davies (jpds) wrote :

This just worked for me.

Revision history for this message
Marco Ceppi (marcoceppi) wrote :

Deferring to openstack-charmers

review: Abstain
Revision history for this message
Jonathan Davies (jpds) wrote :

+1.

review: Approve
Revision history for this message
Ante Karamatić (ivoks) :
review: Approve
Revision history for this message
Ante Karamatić (ivoks) wrote :

Is 0o600 a typo?

Revision history for this message
James Page (james-page) wrote :

No - its fine

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/horizon_hooks.py'
2--- hooks/horizon_hooks.py 2013-09-27 16:07:33 +0000
3+++ hooks/horizon_hooks.py 2014-01-22 10:38:37 +0000
4@@ -34,6 +34,7 @@
5 from charmhelpers.contrib.hahelpers.apache import install_ca_cert
6 from charmhelpers.contrib.hahelpers.cluster import get_hacluster_config
7 from charmhelpers.payload.execd import execd_preinstall
8+from base64 import b64decode
9
10 hooks = Hooks()
11 CONFIGS = register_configs()
12@@ -95,7 +96,7 @@
13 def keystone_changed():
14 CONFIGS.write(LOCAL_SETTINGS)
15 if relation_get('ca_cert'):
16- install_ca_cert(relation_get('ca_cert'))
17+ install_ca_cert(b64decode(relation_get('ca_cert')))
18
19
20 @hooks.hook('cluster-relation-departed',
21
22=== modified file 'unit_tests/test_horizon_contexts.py'
23--- unit_tests/test_horizon_contexts.py 2013-09-27 14:39:31 +0000
24+++ unit_tests/test_horizon_contexts.py 2014-01-22 10:38:37 +0000
25@@ -40,6 +40,7 @@
26
27
28 class TestHorizonContexts(CharmTestCase):
29+
30 def setUp(self):
31 super(TestHorizonContexts, self).setUp(horizon_contexts, TO_PATCH)
32 self.config.side_effect = self.test_config.get
33@@ -67,7 +68,7 @@
34 call('key')
35 ])
36 # Security check on key permissions
37- _chmod.assert_called_with('/etc/ssl/private/dashboard.key', 0600)
38+ _chmod.assert_called_with('/etc/ssl/private/dashboard.key', 0o600)
39
40 def test_ApacheSSLContext_disabled(self):
41 self.get_cert.return_value = (None, None)
42
43=== modified file 'unit_tests/test_horizon_hooks.py'
44--- unit_tests/test_horizon_hooks.py 2013-10-15 14:11:27 +0000
45+++ unit_tests/test_horizon_hooks.py 2014-01-22 10:38:37 +0000
46@@ -27,7 +27,12 @@
47 'install_ca_cert',
48 'unit_get',
49 'log',
50- 'execd_preinstall']
51+ 'execd_preinstall',
52+ 'b64decode']
53+
54+
55+def passthrough(value):
56+ return value
57
58
59 class TestHorizonHooks(CharmTestCase):
60@@ -35,6 +40,7 @@
61 def setUp(self):
62 super(TestHorizonHooks, self).setUp(hooks, TO_PATCH)
63 self.config.side_effect = self.test_config.get
64+ self.b64decode.side_effect = passthrough
65
66 def _call_hook(self, hookname):
67 hooks.hooks.execute([
68
69=== modified file 'unit_tests/test_horizon_utils.py'
70--- unit_tests/test_horizon_utils.py 2013-09-25 15:49:51 +0000
71+++ unit_tests/test_horizon_utils.py 2014-01-22 10:38:37 +0000
72@@ -20,6 +20,7 @@
73
74
75 class TestHorizonUtils(CharmTestCase):
76+
77 def setUp(self):
78 super(TestHorizonUtils, self).setUp(horizon_utils, TO_PATCH)
79
80
81=== modified file 'unit_tests/test_utils.py'
82--- unit_tests/test_utils.py 2013-07-18 08:37:37 +0000
83+++ unit_tests/test_utils.py 2014-01-22 10:38:37 +0000
84@@ -44,6 +44,7 @@
85
86
87 class CharmTestCase(unittest.TestCase):
88+
89 def setUp(self, obj, patches):
90 super(CharmTestCase, self).setUp()
91 self.patches = patches
92@@ -64,6 +65,7 @@
93
94
95 class TestConfig(object):
96+
97 def __init__(self):
98 self.config = get_default_config()
99
100@@ -83,6 +85,7 @@
101
102
103 class TestRelation(object):
104+
105 def __init__(self, relation_data={}):
106 self.relation_data = relation_data
107

Subscribers

People subscribed via source and target branches

to all changes: