diff --git a/barbican/cmd/__init__.py b/barbican/cmd/__init__.py new file mode 100644 index 000000000..cfe549ab5 --- /dev/null +++ b/barbican/cmd/__init__.py @@ -0,0 +1,18 @@ +# Copyright 2010-2015 OpenStack LLC. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +""" +Barbican cmd module +""" diff --git a/bin/barbican-db-manage.py b/barbican/cmd/db_manage.py similarity index 87% rename from bin/barbican-db-manage.py rename to barbican/cmd/db_manage.py index 89a73ed7e..e4e28ac60 100755 --- a/bin/barbican-db-manage.py +++ b/barbican/cmd/db_manage.py @@ -1,8 +1,23 @@ #!/usr/bin/env python +# Copyright 2010-2015 OpenStack LLC. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import argparse import os import sys -import argparse sys.path.insert(0, os.getcwd()) @@ -11,10 +26,10 @@ from barbican.model.migration import commands from oslo_log import log -class DatabaseManager: - """ - Builds and executes a CLI parser to manage the Barbican database, - using Alembic commands. +class DatabaseManager(object): + """Builds and executes a CLI parser to manage the Barbican + + This extends the Alembic commands. """ def __init__(self, conf): diff --git a/bin/barbican-keystone-listener.py b/barbican/cmd/keystone_listener.py similarity index 99% rename from bin/barbican-keystone-listener.py rename to barbican/cmd/keystone_listener.py index eab1c5eb0..f4c43e2f7 100755 --- a/bin/barbican-keystone-listener.py +++ b/barbican/cmd/keystone_listener.py @@ -1,5 +1,4 @@ #!/usr/bin/env python - # Copyright 2014 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -75,4 +74,3 @@ if __name__ == '__main__': LOG.info("Exiting as Barbican Keystone listener is not enabled...") except RuntimeError as e: fail(1, e) - diff --git a/bin/barbican-worker.py b/barbican/cmd/worker.py similarity index 98% rename from bin/barbican-worker.py rename to barbican/cmd/worker.py index 02e3d8dcb..52410f1f8 100755 --- a/bin/barbican-worker.py +++ b/barbican/cmd/worker.py @@ -49,7 +49,7 @@ def fail(returncode, e): sys.exit(returncode) -if __name__ == '__main__': +def main(): try: CONF = config.CONF @@ -68,3 +68,6 @@ if __name__ == '__main__': except RuntimeError as e: fail(1, e) + +if __name__ == '__main__': + main() diff --git a/bin/barbican-worker-retry-scheduler.py b/barbican/cmd/worker_retry_scheduler.py similarity index 98% rename from bin/barbican-worker-retry-scheduler.py rename to barbican/cmd/worker_retry_scheduler.py index 61f8b58c9..cd9b3fb4a 100755 --- a/bin/barbican-worker-retry-scheduler.py +++ b/barbican/cmd/worker_retry_scheduler.py @@ -40,7 +40,6 @@ from barbican.common import config from barbican import queue from barbican.queue import retry_scheduler -from oslo_config import cfg from oslo_log import log from oslo_service import service @@ -50,7 +49,7 @@ def fail(returncode, e): sys.exit(returncode) -if __name__ == '__main__': +def main(): try: CONF = config.CONF @@ -68,3 +67,7 @@ if __name__ == '__main__': ).wait() except RuntimeError as e: fail(1, e) + + +if __name__ == '__main__': + main() diff --git a/setup.cfg b/setup.cfg index 1a958100e..f91955c3a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -20,13 +20,14 @@ classifier = [files] packages = barbican -scripts = - bin/barbican.sh - bin/barbican-worker.py - bin/barbican-keystone-listener.py - bin/barbican-db-manage.py [entry_points] +console_scripts = + barbican-db-manage = barbican.cmd.db_manage:main + barbican-keystone-listener = barbican.cmd.keystone_listener:main + barbican-worker = barbican.cmd.worker:main + barbican-worker-retry-scheduler = barbican.cmd.worker_retry_scheduler:main + barbican.secretstore.plugin = store_crypto = barbican.plugin.store_crypto:StoreCryptoAdapterPlugin dogtag_crypto = barbican.plugin.dogtag:DogtagKRAPlugin