diff --git a/barbican/cmd/barbican_manage.py b/barbican/cmd/barbican_manage.py index b991554c2..642c3aadf 100644 --- a/barbican/cmd/barbican_manage.py +++ b/barbican/cmd/barbican_manage.py @@ -30,6 +30,7 @@ from barbican.common import config from barbican.model import clean from barbican.model.migration import commands from barbican.model import sync +from barbican.plugin.crypto import p11_crypto from barbican.plugin.crypto import pkcs11 import barbican.version @@ -69,8 +70,8 @@ class DbCommands(object): @args('--soft-delete-expired-secrets', '-e', action='store_true', dest='do_soft_delete_expired_secrets', default=False, help='Soft delete secrets that are expired.') - def clean(self, dburl=None, min_days=None, verbose=None, log_file=None, - do_clean_unassociated_projects=None, + def clean(self, conf, dburl=None, min_days=None, verbose=None, + log_file=None, do_clean_unassociated_projects=None, do_soft_delete_expired_secrets=None): """Clean soft deletions in the database""" if dburl is None: @@ -94,7 +95,7 @@ class DbCommands(object): help='the message for the DB change') @args('--autogenerate', action="store_true", dest='autogen', default=False, help='autogenerate from models') - def revision(self, dburl=None, message=None, autogen=None): + def revision(self, conf, dburl=None, message=None, autogen=None): """Process the 'revision' Alembic command.""" if dburl is None: commands.generate(autogenerate=autogen, message=str(message), @@ -110,7 +111,7 @@ class DbCommands(object): @args('--version', '-v', metavar='', default='head', help='the version to upgrade to, or else ' 'the latest/head if not specified.') - def upgrade(self, dburl=None, version=None): + def upgrade(self, conf, dburl=None, version=None): """Process the 'upgrade' Alembic command.""" if dburl is None: commands.upgrade(to_version=str(version), @@ -124,7 +125,7 @@ class DbCommands(object): help='barbican database URL') @args('--verbose', '-V', action='store_true', dest='verbose', default=False, help='Show full information about the revisions.') - def history(self, dburl=None, verbose=None): + def history(self, conf, dburl=None, verbose=None): if dburl is None: commands.history(verbose, sql_url=CONF.sql_connection) else: @@ -136,7 +137,7 @@ class DbCommands(object): help='barbican database URL') @args('--verbose', '-V', action='store_true', dest='verbose', default=False, help='Show full information about the revisions.') - def current(self, dburl=None, verbose=None): + def current(self, conf, dburl=None, verbose=None): if dburl is None: commands.current(verbose, sql_url=CONF.sql_connection) else: @@ -152,7 +153,8 @@ class DbCommands(object): dest='log_file', help='Set log file location. ' 'Default value for log_file can be found in barbican.conf') - def sync_secret_stores(self, dburl=None, verbose=None, log_file=None): + def sync_secret_stores(self, conf, dburl=None, verbose=None, + log_file=None): """Sync secret_stores table with barbican.conf""" if dburl is None: dburl = CONF.sql_connection @@ -168,61 +170,66 @@ class DbCommands(object): class HSMCommands(object): """Class for managing HSM/pkcs11 plugin""" + _CKK_AES = 'CKK_AES' + description = "Subcommands for managing HSM/PKCS11" check_mkek_description = "Checks if a MKEK label is available" @args('--library-path', metavar='', dest='libpath', - default='/usr/lib/libCryptoki2_64.so', - help='Path to vendor PKCS11 library') - @args('--slot-id', metavar='', dest='slotid', default=1, - help='HSM Slot id (Should correspond to a configured PKCS11 slot, \ - default is 1)') - @args('--passphrase', metavar='', default=None, required=True, - help='Password to login to PKCS11 session') - @args('--label', '-L', metavar='