Merge lp:~hopem/charms/trusty/openstack-dashboard/fix-missing-ssl-ca into lp:~openstack-charmers-archive/charms/trusty/openstack-dashboard/next

Proposed by Edward Hope-Morley
Status: Merged
Merged at revision: 58
Proposed branch: lp:~hopem/charms/trusty/openstack-dashboard/fix-missing-ssl-ca
Merge into: lp:~openstack-charmers-archive/charms/trusty/openstack-dashboard/next
Diff against target: 60 lines (+13/-1)
3 files modified
config.yaml (+5/-0)
hooks/horizon_contexts.py (+6/-1)
unit_tests/test_horizon_contexts.py (+2/-0)
To merge this branch: bzr merge lp:~hopem/charms/trusty/openstack-dashboard/fix-missing-ssl-ca
Reviewer Review Type Date Requested Status
James Page Approve
Review via email: mp+255682@code.launchpad.net
To post a comment you must log in.
59. By Edward Hope-Morley

added b64decode

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

charm_lint_check #3190 openstack-dashboard-next for hopem mp255682
    LINT OK: passed

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

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

charm_unit_test #2978 openstack-dashboard-next for hopem mp255682
    UNIT OK: passed

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

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

charm_amulet_test #3000 openstack-dashboard-next for hopem mp255682
    AMULET OK: passed

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

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'config.yaml'
2--- config.yaml 2015-02-19 04:44:24 +0000
3+++ config.yaml 2015-04-09 14:56:10 +0000
4@@ -79,6 +79,11 @@
5 default:
6 description: |
7 Base64 encoded SSL key to use with certificate specified as ssl_cert.
8+ ssl_ca:
9+ type: string
10+ default:
11+ description: |
12+ Base64 encoded certificate authority.
13 offline-compression:
14 type: string
15 default: "yes"
16
17=== modified file 'hooks/horizon_contexts.py'
18--- hooks/horizon_contexts.py 2015-02-12 09:23:26 +0000
19+++ hooks/horizon_contexts.py 2015-04-09 14:56:10 +0000
20@@ -14,7 +14,9 @@
21 context_complete
22 )
23 from charmhelpers.contrib.hahelpers.apache import (
24- get_cert
25+ get_ca_cert,
26+ get_cert,
27+ install_ca_cert,
28 )
29 from charmhelpers.contrib.network.ip import (
30 get_ipv6_addr,
31@@ -140,6 +142,9 @@
32 class ApacheSSLContext(OSContextGenerator):
33 def __call__(self):
34 ''' Grab cert and key from configuration for SSL config '''
35+ ca_cert = get_ca_cert()
36+ if ca_cert:
37+ install_ca_cert(b64decode(ca_cert))
38 (ssl_cert, ssl_key) = get_cert()
39 if None not in [ssl_cert, ssl_key]:
40 with open('/etc/ssl/certs/dashboard.cert', 'w') as cert_out:
41
42=== modified file 'unit_tests/test_horizon_contexts.py'
43--- unit_tests/test_horizon_contexts.py 2015-02-12 09:23:26 +0000
44+++ unit_tests/test_horizon_contexts.py 2015-04-09 14:56:10 +0000
45@@ -50,6 +50,7 @@
46 self.assertEquals(horizon_contexts.ApacheContext()(),
47 {'http_port': 70, 'https_port': 433})
48
49+ @patch.object(horizon_contexts, 'get_ca_cert', lambda: None)
50 @patch('os.chmod')
51 def test_ApacheSSLContext_enabled(self, _chmod):
52 self.get_cert.return_value = ('cert', 'key')
53@@ -70,6 +71,7 @@
54 # Security check on key permissions
55 _chmod.assert_called_with('/etc/ssl/private/dashboard.key', 0o600)
56
57+ @patch.object(horizon_contexts, 'get_ca_cert', lambda: None)
58 def test_ApacheSSLContext_disabled(self):
59 self.get_cert.return_value = (None, None)
60 self.assertEquals(horizon_contexts.ApacheSSLContext()(),

Subscribers

People subscribed via source and target branches