diff --git a/barbican/cmd/barbican_manage.py b/barbican/cmd/barbican_manage.py index af0ad63cd..ebdba8d35 100644 --- a/barbican/cmd/barbican_manage.py +++ b/barbican/cmd/barbican_manage.py @@ -32,6 +32,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 @@ -71,8 +72,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: @@ -96,7 +97,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), @@ -112,7 +113,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), @@ -126,7 +127,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: @@ -138,7 +139,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: @@ -154,7 +155,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 @@ -170,61 +172,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='