Drop file extensions for /usr/bin/*

Previously there were 4 python scripts being installed
into /usr/{local/}bin/ which contained the extension *.py.
There was also a developers script called barbican.sh
to create a developer's environment.

This change switches away from installing them as scripts,
preferring to use pbr's console_scripts entry point.  This
means that the scripts were moved to be part of a 'cmd'
module within the barbican module.

The barbican.sh script is also no longer installed as it
seems inappropriate to install this on consumers machines.

A few cosmetic changes were added to achieve pep8.

Change-Id: I452b56535ec18228060370be899af2a63d138472
Closes-Bug: 1454587
Signed-off-by: Dave Walker (Daviey) <email@daviey.com>
This commit is contained in:
Dave Walker (Daviey) 2015-06-17 22:45:07 +00:00
parent 64591def2d
commit 63102c02dc
6 changed files with 53 additions and 15 deletions

18
barbican/cmd/__init__.py Normal file
View File

@ -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
"""

View File

@ -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):

View File

@ -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)

View File

@ -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()

View File

@ -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()

View File

@ -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