fixed a few problems

This commit is contained in:
sirferl 2020-09-14 15:18:46 +02:00
parent b8e3162c5f
commit 84496b0f55

View File

@ -68,7 +68,7 @@ def handle_response(my_response):
try: try:
d = json.loads(my_response.content) d = json.loads(my_response.content)
except: except:
d = {'errors': 'No error message'} d = {'errors': 'No detailled message'}
s = my_response.status_code s = my_response.status_code
if s > 399: if s > 399:
raise Exception("ENTRUST error: {0}\n{1}".format(msg.get(s, s), d['errors'])) raise Exception("ENTRUST error: {0}\n{1}".format(msg.get(s, s), d['errors']))
@ -151,12 +151,17 @@ class EntrustIssuerPlugin(IssuerPlugin):
base_url = current_app.config.get("ENTRUST_URL") base_url = current_app.config.get("ENTRUST_URL")
# make certificate revoke request # make certificate revoke request
create_url = "{0}/certificates/{1}/revocations".format( revoke_url = "{0}/certificates/{1}/revocations".format(
base_url, certificate.external_id base_url, certificate.external_id
) )
metrics.send("entrust_revoke_certificate", "counter", 1) metrics.send("entrust_revoke_certificate", "counter", 1)
response = self.session.put(create_url, if comments == '' or comments == None:
data=json.dumps({"crlReason": "superseded", "comments": comments})) comments = "revoked via API"
data = {
"crlReason": "superseded",
"revocationComment": comments
}
response = self.session.post(revoke_url, json = data)
data = handle_response(response) data = handle_response(response)