Initial work allowing certificates to be revoked. (#941)

* Initial work allowing for certificates to be revoked.
This commit is contained in:
kevgliss
2017-09-28 18:27:56 -07:00
committed by GitHub
parent ea6f5c920b
commit bb08b1e637
23 changed files with 286 additions and 47 deletions

View File

@ -3,6 +3,9 @@ from alembic import context
from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig
import alembic_autogenerate_enums
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config

View File

@ -14,28 +14,8 @@ from alembic import op
def upgrade():
connection = None
if not op.get_context().as_sql:
connection = op.get_bind()
connection.execution_options(isolation_level='AUTOCOMMIT')
op.execute("ALTER TYPE log_type ADD VALUE 'create_cert'")
op.execute("ALTER TYPE log_type ADD VALUE 'update_cert'")
if connection is not None:
connection.execution_options(isolation_level='READ_COMMITTED')
op.sync_enum_values('public', 'log_type', ['key_view'], ['create_cert', 'key_view', 'update_cert'])
def downgrade():
connection = None
if not op.get_context().as_sql:
connection = op.get_bind()
connection.execution_options(isolation_level='AUTOCOMMIT')
op.execute("ALTER TYPE log_type DROP VALUE 'create_cert'")
op.execute("ALTER TYPE log_type DROP VALUE 'update_cert'")
if connection is not None:
connection.execution_options(isolation_level='READ_COMMITTED')
op.sync_enum_values('public', 'log_type', ['create_cert', 'key_view', 'update_cert'], ['key_view'])

View File

@ -0,0 +1,28 @@
"""Adds external ID checking and modifying enum
Revision ID: b29e2c4bf8c9
Revises: 1ae8e3104db8
Create Date: 2017-09-26 10:50:35.740367
"""
# revision identifiers, used by Alembic.
revision = 'b29e2c4bf8c9'
down_revision = '1ae8e3104db8'
from alembic import op
import sqlalchemy as sa
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('certificates', sa.Column('external_id', sa.String(128), nullable=True))
op.sync_enum_values('public', 'log_type', ['create_cert', 'key_view', 'update_cert'], ['create_cert', 'key_view', 'revoke_cert', 'update_cert'])
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.sync_enum_values('public', 'log_type', ['create_cert', 'key_view', 'revoke_cert', 'update_cert'], ['create_cert', 'key_view', 'update_cert'])
op.drop_column('certificates', 'external_id')
# ### end Alembic commands ###