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
=== modified file 'config.yaml'
--- config.yaml 2015-02-19 04:44:24 +0000
+++ config.yaml 2015-04-09 14:56:10 +0000
@@ -79,6 +79,11 @@
79 default:79 default:
80 description: |80 description: |
81 Base64 encoded SSL key to use with certificate specified as ssl_cert.81 Base64 encoded SSL key to use with certificate specified as ssl_cert.
82 ssl_ca:
83 type: string
84 default:
85 description: |
86 Base64 encoded certificate authority.
82 offline-compression:87 offline-compression:
83 type: string88 type: string
84 default: "yes"89 default: "yes"
8590
=== modified file 'hooks/horizon_contexts.py'
--- hooks/horizon_contexts.py 2015-02-12 09:23:26 +0000
+++ hooks/horizon_contexts.py 2015-04-09 14:56:10 +0000
@@ -14,7 +14,9 @@
14 context_complete14 context_complete
15)15)
16from charmhelpers.contrib.hahelpers.apache import (16from charmhelpers.contrib.hahelpers.apache import (
17 get_cert17 get_ca_cert,
18 get_cert,
19 install_ca_cert,
18)20)
19from charmhelpers.contrib.network.ip import (21from charmhelpers.contrib.network.ip import (
20 get_ipv6_addr,22 get_ipv6_addr,
@@ -140,6 +142,9 @@
140class ApacheSSLContext(OSContextGenerator):142class ApacheSSLContext(OSContextGenerator):
141 def __call__(self):143 def __call__(self):
142 ''' Grab cert and key from configuration for SSL config '''144 ''' Grab cert and key from configuration for SSL config '''
145 ca_cert = get_ca_cert()
146 if ca_cert:
147 install_ca_cert(b64decode(ca_cert))
143 (ssl_cert, ssl_key) = get_cert()148 (ssl_cert, ssl_key) = get_cert()
144 if None not in [ssl_cert, ssl_key]:149 if None not in [ssl_cert, ssl_key]:
145 with open('/etc/ssl/certs/dashboard.cert', 'w') as cert_out:150 with open('/etc/ssl/certs/dashboard.cert', 'w') as cert_out:
146151
=== modified file 'unit_tests/test_horizon_contexts.py'
--- unit_tests/test_horizon_contexts.py 2015-02-12 09:23:26 +0000
+++ unit_tests/test_horizon_contexts.py 2015-04-09 14:56:10 +0000
@@ -50,6 +50,7 @@
50 self.assertEquals(horizon_contexts.ApacheContext()(),50 self.assertEquals(horizon_contexts.ApacheContext()(),
51 {'http_port': 70, 'https_port': 433})51 {'http_port': 70, 'https_port': 433})
5252
53 @patch.object(horizon_contexts, 'get_ca_cert', lambda: None)
53 @patch('os.chmod')54 @patch('os.chmod')
54 def test_ApacheSSLContext_enabled(self, _chmod):55 def test_ApacheSSLContext_enabled(self, _chmod):
55 self.get_cert.return_value = ('cert', 'key')56 self.get_cert.return_value = ('cert', 'key')
@@ -70,6 +71,7 @@
70 # Security check on key permissions71 # Security check on key permissions
71 _chmod.assert_called_with('/etc/ssl/private/dashboard.key', 0o600)72 _chmod.assert_called_with('/etc/ssl/private/dashboard.key', 0o600)
7273
74 @patch.object(horizon_contexts, 'get_ca_cert', lambda: None)
73 def test_ApacheSSLContext_disabled(self):75 def test_ApacheSSLContext_disabled(self):
74 self.get_cert.return_value = (None, None)76 self.get_cert.return_value = (None, None)
75 self.assertEquals(horizon_contexts.ApacheSSLContext()(),77 self.assertEquals(horizon_contexts.ApacheSSLContext()(),

Subscribers

People subscribed via source and target branches