lint errors and removed _path from the API-Cert variables
This commit is contained in:
parent
84496b0f55
commit
5bb0143da4
|
@ -67,7 +67,8 @@ def handle_response(my_response):
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
d = json.loads(my_response.content)
|
d = json.loads(my_response.content)
|
||||||
except:
|
except Exception as e:
|
||||||
|
# catch an empty jason object here
|
||||||
d = {'errors': 'No detailled message'}
|
d = {'errors': 'No detailled message'}
|
||||||
s = my_response.status_code
|
s = my_response.status_code
|
||||||
if s > 399:
|
if s > 399:
|
||||||
|
@ -102,12 +103,12 @@ class EntrustIssuerPlugin(IssuerPlugin):
|
||||||
validate_conf(current_app, required_vars)
|
validate_conf(current_app, required_vars)
|
||||||
|
|
||||||
self.session = requests.Session()
|
self.session = requests.Session()
|
||||||
cert_file_path = current_app.config.get("ENTRUST_API_CERT")
|
cert_file = current_app.config.get("ENTRUST_API_CERT")
|
||||||
key_file_path = current_app.config.get("ENTRUST_API_KEY")
|
key_file = current_app.config.get("ENTRUST_API_KEY")
|
||||||
user = current_app.config.get("ENTRUST_API_USER")
|
user = current_app.config.get("ENTRUST_API_USER")
|
||||||
passw = current_app.config.get("ENTRUST_API_PASS")
|
password = current_app.config.get("ENTRUST_API_PASS")
|
||||||
self.session.cert = (cert_file_path, key_file_path)
|
self.session.cert = (cert_file_path, key_file_path)
|
||||||
self.session.auth = (user, passw)
|
self.session.auth = (user, password)
|
||||||
self.session.hooks = dict(response=log_status_code)
|
self.session.hooks = dict(response=log_status_code)
|
||||||
# self.session.config['keep_alive'] = False
|
# self.session.config['keep_alive'] = False
|
||||||
super(EntrustIssuerPlugin, self).__init__(*args, **kwargs)
|
super(EntrustIssuerPlugin, self).__init__(*args, **kwargs)
|
||||||
|
@ -155,16 +156,15 @@ class EntrustIssuerPlugin(IssuerPlugin):
|
||||||
base_url, certificate.external_id
|
base_url, certificate.external_id
|
||||||
)
|
)
|
||||||
metrics.send("entrust_revoke_certificate", "counter", 1)
|
metrics.send("entrust_revoke_certificate", "counter", 1)
|
||||||
if comments == '' or comments == None:
|
if comments == '' or not comments:
|
||||||
comments = "revoked via API"
|
comments = "revoked via API"
|
||||||
data = {
|
data = {
|
||||||
"crlReason": "superseded",
|
"crlReason": "superseded",
|
||||||
"revocationComment": comments
|
"revocationComment": comments
|
||||||
}
|
}
|
||||||
response = self.session.post(revoke_url, json = data)
|
response = self.session.post(revoke_url, json=data)
|
||||||
|
|
||||||
data = handle_response(response)
|
data = handle_response(response)
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def create_authority(options):
|
def create_authority(options):
|
||||||
|
|
Loading…
Reference in New Issue