fixing a few minor issue with cloning (#544)

This commit is contained in:
kevgliss 2016-11-30 10:54:53 -08:00 committed by GitHub
parent f9b16a2110
commit abb91fbb65
3 changed files with 20 additions and 9 deletions

View File

@ -168,6 +168,20 @@ def handle_response(response):
return response.json() return response.json()
def handle_cis_response(response):
"""
Handle the DigiCert CIS API response and any errors it might have experienced.
:param response:
:return:
"""
metrics.send('digicert_cis_status_code_{0}'.format(response.status_code), 'counter', 1)
if response.status_code > 399:
raise Exception(response.json()['errors'][0]['message'])
return response.json()
@retry(stop_max_attempt_number=10, wait_fixed=10000) @retry(stop_max_attempt_number=10, wait_fixed=10000)
def get_certificate_id(session, base_url, order_id): def get_certificate_id(session, base_url, order_id):
"""Retrieve certificate order id from Digicert API.""" """Retrieve certificate order id from Digicert API."""
@ -341,15 +355,10 @@ class DigiCertCISIssuerPlugin(IssuerPlugin):
data = map_cis_fields(issuer_options, csr) data = map_cis_fields(issuer_options, csr)
response = self.session.post(create_url, data=json.dumps(data)) response = self.session.post(create_url, data=json.dumps(data))
data = handle_cis_response(response)
current_app.logger.debug(data)
if response.status_code > 399:
raise Exception(response.json()['errors'][0]['message'])
order_id = response.json()['id']
# retrieve certificate # retrieve certificate
certificate_pem = get_cis_certificate(self.session, base_url, order_id) certificate_pem = get_cis_certificate(self.session, base_url, data['id'])
end_entity = pem.parse(certificate_pem)[0] end_entity = pem.parse(certificate_pem)[0]
return str(end_entity), current_app.config.get('DIGICERT_CIS_INTERMEDIATE') return str(end_entity), current_app.config.get('DIGICERT_CIS_INTERMEDIATE')

View File

@ -214,8 +214,8 @@ angular.module('lemur')
CertificateApi.get(editId).then(function (certificate) { CertificateApi.get(editId).then(function (certificate) {
$scope.certificate = certificate; $scope.certificate = certificate;
$scope.certificate.name = ''; // we should prefer the generated name $scope.certificate.name = ''; // we should prefer the generated name
$scope.validityStart = null; // we should rely the defaults $scope.certificate.validityStart = Date.parse($scope.certificate.validityStart); // we should rely the defaults
$scope.validityEnd = null; // we should rely on the defaults $scope.certificate.validityEnd = Date.parse($scope.certificate.validityEnd); // we should rely on the defaults
CertificateService.getDefaults($scope.certificate); CertificateService.getDefaults($scope.certificate);
}); });

View File

@ -107,6 +107,7 @@
<div class="col-sm-3"> <div class="col-sm-3">
<div class="input-group"> <div class="input-group">
<input type="text" class="form-control" <input type="text" class="form-control"
uib-tooltip="yyyy/MM/dd"
uib-datepicker-popup="yyyy/MM/dd" uib-datepicker-popup="yyyy/MM/dd"
ng-model="certificate.validityStart" ng-model="certificate.validityStart"
is-open="popup1.opened" is-open="popup1.opened"
@ -126,6 +127,7 @@
<div class="col-sm-3"> <div class="col-sm-3">
<div class="input-group"> <div class="input-group">
<input type="text" class="form-control" <input type="text" class="form-control"
uib-tooltip="yyyy/MM/dd"
uib-datepicker-popup="yyyy/MM/dd" uib-datepicker-popup="yyyy/MM/dd"
ng-model="certificate.validityEnd" ng-model="certificate.validityEnd"
is-open="popup2.opened" is-open="popup2.opened"