Minor changes for python3. (#477)
This commit is contained in:
parent
4afedaf537
commit
b74df2b3e4
|
@ -136,7 +136,7 @@ def validate_schema(input_schema, output_schema):
|
|||
resp = f(*args, **kwargs)
|
||||
except Exception as e:
|
||||
current_app.logger.exception(e)
|
||||
return dict(message=e.message), 500
|
||||
return dict(message=str(e)), 500
|
||||
|
||||
if isinstance(resp, tuple):
|
||||
return resp[0], resp[1]
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
.. moduleauthor:: Kevin Glisson <kglisson@netflix.com>
|
||||
"""
|
||||
import six
|
||||
import sys
|
||||
import string
|
||||
import random
|
||||
|
@ -36,11 +37,13 @@ def get_psuedo_random_string():
|
|||
|
||||
|
||||
def parse_certificate(body):
|
||||
if sys.version_info >= (3, 0):
|
||||
if isinstance(body, bytes):
|
||||
return x509.load_pem_x509_certificate(body, default_backend())
|
||||
return x509.load_pem_x509_certificate(bytes(body, 'utf8'), default_backend())
|
||||
return x509.load_pem_x509_certificate(body.encode('utf-8'), default_backend())
|
||||
if sys.version_info[0] <= 2:
|
||||
return x509.load_pem_x509_certificate(bytes(body), default_backend())
|
||||
|
||||
if isinstance(body, six.string_types):
|
||||
body = body.encode('utf-8')
|
||||
|
||||
return x509.load_pem_x509_certificate(body, default_backend())
|
||||
|
||||
|
||||
def is_weekend(date):
|
||||
|
|
|
@ -21,7 +21,6 @@ from lemur.common.utils import get_psuedo_random_string
|
|||
# https://support.venafi.com/entries/66445046-Info-VeriSign-Error-Codes
|
||||
VERISIGN_ERRORS = {
|
||||
"0x30c5": "Domain Mismatch when enrolling for an SSL certificate, a domain in your request has not been added to verisign",
|
||||
"0x482d": "Cannot issue SHA1 certificates expiring after 31/12/2016",
|
||||
"0x3a10": "Invalid X509 certificate format.: an unsupported certificate format was submitted",
|
||||
"0x4002": "Internal QM Error. : Internal Database connection error.",
|
||||
"0x3301": "Bad transaction id or parent cert not renewable.: User try to renew a certificate that is not yet ready for renew or the transaction id is wrong",
|
||||
|
@ -58,6 +57,7 @@ VERISIGN_ERRORS = {
|
|||
"0x3105": "Organization Name Not Matched",
|
||||
"0x300a": "Domain/SubjectAltName Mismatched -- make sure that the SANs have the proper domain suffix",
|
||||
"0x950e": "Invalid Common Name -- make sure the CN has a proper domain suffix",
|
||||
"0xa00e": "Pending. (Insufficient number of tokens.)"
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue