From cca379766999eef7d1f2387c560cb7a996fe3912 Mon Sep 17 00:00:00 2001 From: Curtis Castrapel Date: Mon, 26 Feb 2018 12:08:31 -0800 Subject: [PATCH 1/3] comments on alembic changes. resolve invalid usage of log_service.create --- lemur/certificates/views.py | 2 +- lemur/migrations/versions/5770674184de_.py | 2 ++ lemur/migrations/versions/ce547319f7be_.py | 6 ++++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lemur/certificates/views.py b/lemur/certificates/views.py index ed717b6e..80355950 100644 --- a/lemur/certificates/views.py +++ b/lemur/certificates/views.py @@ -270,7 +270,7 @@ class CertificatesList(AuthenticatedResource): cert = service.create(**data) if isinstance(cert, Certificate): # only log if created, not pending - log_service.create(g.user, 'create_cert', 'OK', certificate=cert) + log_service.create(g.user, 'create_cert', certificate=cert) return cert return dict(message="You are not authorized to use the authority: {0}".format(data['authority'].name)), 403 diff --git a/lemur/migrations/versions/5770674184de_.py b/lemur/migrations/versions/5770674184de_.py index 99183525..88262a84 100644 --- a/lemur/migrations/versions/5770674184de_.py +++ b/lemur/migrations/versions/5770674184de_.py @@ -18,6 +18,7 @@ session = db.session() def upgrade(): + print("Querying for all entries in certificate_notification_associations.") # Query for all entries in table results = session.query(certificate_notification_associations).with_entities( certificate_notification_associations.c.certificate_id, @@ -30,6 +31,7 @@ def upgrade(): for x in results: # If we've seen a pair already, delete the duplicates if seen.get("{}-{}".format(x.certificate_id, x.notification_id)): + print("Deleting duplicate: {}".format(x)) d = session.query(certificate_notification_associations).filter(certificate_notification_associations.c.id==x.id) d.delete(synchronize_session=False) seen["{}-{}".format(x.certificate_id, x.notification_id)] = True diff --git a/lemur/migrations/versions/ce547319f7be_.py b/lemur/migrations/versions/ce547319f7be_.py index fb130466..41ef1fa8 100644 --- a/lemur/migrations/versions/ce547319f7be_.py +++ b/lemur/migrations/versions/ce547319f7be_.py @@ -27,8 +27,10 @@ def upgrade(): TABLE, sa.Column('id', sa.Integer, primary_key=True, autoincrement=True) ) - + db.session.commit() + db.session.flush() def downgrade(): op.drop_column(TABLE, "id") - + db.session.commit() + db.session.flush() From 1f641c0ba60ab8ef7cb6622a3c3ecaf8a1dc6f22 Mon Sep 17 00:00:00 2001 From: Curtis Castrapel Date: Mon, 26 Feb 2018 12:36:40 -0800 Subject: [PATCH 2/3] Description modification --- lemur/plugins/lemur_digicert/plugin.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lemur/plugins/lemur_digicert/plugin.py b/lemur/plugins/lemur_digicert/plugin.py index 3b0c5355..694c6161 100644 --- a/lemur/plugins/lemur_digicert/plugin.py +++ b/lemur/plugins/lemur_digicert/plugin.py @@ -258,8 +258,10 @@ class DigiCertIssuerPlugin(IssuerPlugin): """Wrap the Digicert Issuer API.""" title = 'DigiCert' slug = 'digicert-issuer' - description = "Enables the creation of certificates by" - "the DigiCert REST API." + description = ( + "Enables the creation of certificates by" + "the DigiCert REST API." + ) version = digicert.VERSION author = 'Kevin Glisson' From 5fe28f6503ec8e3911d502b8294fca2026bdb35f Mon Sep 17 00:00:00 2001 From: Curtis Castrapel Date: Mon, 26 Feb 2018 12:37:31 -0800 Subject: [PATCH 3/3] Description modification --- lemur/plugins/lemur_digicert/plugin.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lemur/plugins/lemur_digicert/plugin.py b/lemur/plugins/lemur_digicert/plugin.py index 694c6161..00fe9519 100644 --- a/lemur/plugins/lemur_digicert/plugin.py +++ b/lemur/plugins/lemur_digicert/plugin.py @@ -258,10 +258,7 @@ class DigiCertIssuerPlugin(IssuerPlugin): """Wrap the Digicert Issuer API.""" title = 'DigiCert' slug = 'digicert-issuer' - description = ( - "Enables the creation of certificates by" - "the DigiCert REST API." - ) + description = "Enables the creation of certificates by the DigiCert REST API." version = digicert.VERSION author = 'Kevin Glisson'