From 1eb3d563c679293dc5248453bc917cf468f68ce2 Mon Sep 17 00:00:00 2001 From: Marti Raudsepp Date: Wed, 14 Dec 2016 23:25:56 +0200 Subject: [PATCH] Fix error reporting for certs without private key (#599) --- lemur/certificates/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lemur/certificates/views.py b/lemur/certificates/views.py index 51c82e47..68db492d 100644 --- a/lemur/certificates/views.py +++ b/lemur/certificates/views.py @@ -636,7 +636,7 @@ class Certificates(AuthenticatedResource): for destination in data['destinations']: if destination.plugin.requires_key: if not cert.private_key: - return dict('Unable to add destination: {0}. Certificate does not have required private key.'.format(destination.label)) + return dict(message='Unable to add destination: {0}. Certificate does not have required private key.'.format(destination.label)), 400 return service.update( certificate_id, @@ -926,7 +926,7 @@ class CertificateExport(AuthenticatedResource): if not cert.private_key: return dict( message='Unable to export certificate, plugin: {0} requires a private key but no key was found.'.format( - plugin.slug)) + plugin.slug)), 400 else: # allow creators