Open file as binary to write bytes

Due to a change in the return types in the base64
decoded data, we should open these files in binary
mode to write the byte streams directly.

Change-Id: I9f88a71406b1e6ea774fdbbeea4ba447901fe5c2
Closes-Bug: #1800436
This commit is contained in:
Chris MacNaughton 2018-10-30 09:32:31 +01:00
parent e4d209fdc1
commit f20ea273f9
1 changed files with 2 additions and 2 deletions

View File

@ -359,9 +359,9 @@ class ConsoleSSLContext(ch_context.OSContextGenerator):
decode_ssl_key = base64.b64decode(
hookenv.config('console-ssl-key'))
with open(cert_path, 'w') as fh:
with open(cert_path, 'wb') as fh:
fh.write(decode_ssl_cert)
with open(key_path, 'w') as fh:
with open(key_path, 'wb') as fh:
fh.write(decode_ssl_key)
ctxt['ssl_only'] = True