Read in ca certificate as binary for PY3

The comparison of bytes vs string of the CA certificate produces a
false negative. This leads to rewriting certificates and affecting
connectivity to services. The writing of the file was changed to bytes
in https://github.com/juju/charm-helpers/pull/58/.

Read in the certificate as bytes as well for a bytes vs bytes
comparison.

Change-Id: I64eb2b90776bb1e37de009208f016f176bd6a82a
Closes-Bug: #1762431
This commit is contained in:
David Ames 2018-05-07 20:59:46 -03:00 committed by Felipe Reyes
parent c5b98f1a26
commit 9053e73d20
1 changed files with 1 additions and 1 deletions

View File

@ -76,7 +76,7 @@ def get_ca_cert():
def retrieve_ca_cert(cert_file):
cert = None
if os.path.isfile(cert_file):
with open(cert_file, 'r') as crt:
with open(cert_file, 'rb') as crt:
cert = crt.read()
return cert