Use bytes instead of str for writing SSL files
Change-Id: I74930cf363fe652a34d7ad86cdc493b15557ed40 Closes-Bug: #1799877
This commit is contained in:
parent
0d1dec7e0b
commit
e41371802f
|
@ -248,9 +248,9 @@ class ApacheSSLContext(OSContextGenerator):
|
|||
|
||||
ssl_cert, ssl_key = get_cert()
|
||||
if all([ssl_cert, ssl_key]):
|
||||
with open('/etc/ssl/certs/dashboard.cert', 'w') as cert_out:
|
||||
with open('/etc/ssl/certs/dashboard.cert', 'wb') as cert_out:
|
||||
cert_out.write(b64decode(ssl_cert))
|
||||
with open('/etc/ssl/private/dashboard.key', 'w') as key_out:
|
||||
with open('/etc/ssl/private/dashboard.key', 'wb') as key_out:
|
||||
key_out.write(b64decode(ssl_key))
|
||||
os.chmod('/etc/ssl/private/dashboard.key', 0o600)
|
||||
ctxt = {
|
||||
|
|
|
@ -108,8 +108,8 @@ class TestHorizonContexts(CharmTestCase):
|
|||
'ssl_cert': '/etc/ssl/certs/dashboard.cert',
|
||||
'ssl_key': '/etc/ssl/private/dashboard.key'})
|
||||
_open.assert_has_calls([
|
||||
call('/etc/ssl/certs/dashboard.cert', 'w'),
|
||||
call('/etc/ssl/private/dashboard.key', 'w')
|
||||
call('/etc/ssl/certs/dashboard.cert', 'wb'),
|
||||
call('/etc/ssl/private/dashboard.key', 'wb')
|
||||
])
|
||||
_file.write.assert_has_calls([
|
||||
call('cert'),
|
||||
|
|
Loading…
Reference in New Issue