From b2539b843bd4285dcf0d3b5e38ee2e220d62a57e Mon Sep 17 00:00:00 2001 From: kevgliss Date: Tue, 31 May 2016 15:44:54 -0700 Subject: [PATCH] Fixing and error causing duplicate roles to be created. (#339) * Fixing and error causing duplicate roles to be created. * Fixing python3 * Fixing python2 and python3 --- lemur/authorities/schemas.py | 2 +- lemur/certificates/models.py | 2 +- .../app/angular/authorities/authority/tracking.tpl.html | 6 +++--- .../app/angular/certificates/certificate/tracking.tpl.html | 1 + lemur/utils.py | 6 +++++- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/lemur/authorities/schemas.py b/lemur/authorities/schemas.py index 7002c4a0..cc045504 100644 --- a/lemur/authorities/schemas.py +++ b/lemur/authorities/schemas.py @@ -57,7 +57,7 @@ class AuthorityInputSchema(LemurInputSchema): @validates_schema def validate_subca(self, data): if data['type'] == 'subca': - if not data.get('authority'): + if not data.get('parent'): raise ValidationError("If generating a subca parent 'authority' must be specified.") diff --git a/lemur/certificates/models.py b/lemur/certificates/models.py index b4f7d8a8..bf123424 100644 --- a/lemur/certificates/models.py +++ b/lemur/certificates/models.py @@ -82,7 +82,7 @@ class Certificate(db.Model): self.destinations = kwargs.get('destinations', []) self.notifications = kwargs.get('notifications', []) self.description = kwargs.get('description') - self.roles = kwargs.get('roles', []) + self.roles = list(set(kwargs.get('roles', []))) self.replaces = kwargs.get('replacements', []) self.signing_algorithm = defaults.signing_algorithm(cert) self.bits = defaults.bitstrength(cert) diff --git a/lemur/static/app/angular/authorities/authority/tracking.tpl.html b/lemur/static/app/angular/authorities/authority/tracking.tpl.html index 5b72d775..3544bf1c 100644 --- a/lemur/static/app/angular/authorities/authority/tracking.tpl.html +++ b/lemur/static/app/angular/authorities/authority/tracking.tpl.html @@ -85,10 +85,10 @@
diff --git a/lemur/static/app/angular/certificates/certificate/tracking.tpl.html b/lemur/static/app/angular/certificates/certificate/tracking.tpl.html index 658ab39e..66d1be76 100644 --- a/lemur/static/app/angular/certificates/certificate/tracking.tpl.html +++ b/lemur/static/app/angular/certificates/certificate/tracking.tpl.html @@ -94,6 +94,7 @@