Switch to EntryPoints for the binaries

This sync's us up with the latest "best practices" as implemented by
the other core components.

Change-Id: I20984b873f360c875d7b810d150275b653e6c4ba
This commit is contained in:
Kiall Mac Innes 2013-08-18 14:26:41 +01:00
parent 42299f4eb1
commit ec908ee933
7 changed files with 75 additions and 54 deletions

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

@ -0,0 +1,18 @@
# Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# Author: Kiall Mac Innes <kiall@hp.com>
#
# 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 eventlet
eventlet.monkey_patch(os=False)

21
bin/designate-agent → designate/cmd/agent.py Executable file → Normal file
View File

@ -1,7 +1,6 @@
#!/usr/bin/env python
# Copyright 2012 Managed I.T.
# Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# Author: Kiall Mac Innes <kiall@managedit.ie>
# Author: Kiall Mac Innes <kiall@hp.com>
#
# 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
@ -15,19 +14,19 @@
# License for the specific language governing permissions and limitations
# under the License.
import sys
import eventlet
from oslo.config import cfg
from designate.openstack.common import log as logging
from designate.openstack.common import service
from designate import utils
from designate.agent import service as agent_service
eventlet.monkey_patch()
CONF = cfg.CONF
CONF.import_opt('workers', 'designate.agent', group='service:agent')
utils.read_config('designate', sys.argv)
logging.setup('designate')
launcher = service.launch(agent_service.Service(),
cfg.CONF['service:agent'].workers)
launcher.wait()
def main():
utils.read_config('designate', sys.argv)
logging.setup('designate')
launcher = service.launch(agent_service.Service(),
CONF['service:agent'].workers)
launcher.wait()

21
bin/designate-api → designate/cmd/api.py Executable file → Normal file
View File

@ -1,7 +1,6 @@
#!/usr/bin/env python
# Copyright 2012 Managed I.T.
# Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# Author: Kiall Mac Innes <kiall@managedit.ie>
# Author: Kiall Mac Innes <kiall@hp.com>
#
# 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
@ -15,19 +14,19 @@
# License for the specific language governing permissions and limitations
# under the License.
import sys
import eventlet
from oslo.config import cfg
from designate.openstack.common import log as logging
from designate.openstack.common import service
from designate import utils
from designate.api import service as api_service
eventlet.monkey_patch()
CONF = cfg.CONF
CONF.import_opt('workers', 'designate.api', group='service:api')
utils.read_config('designate', sys.argv)
logging.setup('designate')
launcher = service.launch(api_service.Service(),
cfg.CONF['service:api'].workers)
launcher.wait()
def main():
utils.read_config('designate', sys.argv)
logging.setup('designate')
launcher = service.launch(api_service.Service(),
CONF['service:api'].workers)
launcher.wait()

21
bin/designate-central → designate/cmd/central.py Executable file → Normal file
View File

@ -1,7 +1,6 @@
#!/usr/bin/env python
# Copyright 2012 Managed I.T.
# Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# Author: Kiall Mac Innes <kiall@managedit.ie>
# Author: Kiall Mac Innes <kiall@hp.com>
#
# 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
@ -15,19 +14,19 @@
# License for the specific language governing permissions and limitations
# under the License.
import sys
import eventlet
from oslo.config import cfg
from designate.openstack.common import log as logging
from designate.openstack.common import service
from designate import utils
from designate.central import service as central_service
eventlet.monkey_patch()
CONF = cfg.CONF
CONF.import_opt('workers', 'designate.central', group='service:central')
utils.read_config('designate', sys.argv)
logging.setup('designate')
launcher = service.launch(central_service.Service(),
cfg.CONF['service:central'].workers)
launcher.wait()
def main():
utils.read_config('designate', sys.argv)
logging.setup('designate')
launcher = service.launch(central_service.Service(),
CONF['service:central'].workers)
launcher.wait()

14
bin/designate-manage → designate/cmd/manage.py Executable file → Normal file
View File

@ -1,4 +1,3 @@
#!/usr/bin/env python
# Copyright 2012 Bouvet ASA
#
# Author: Endre Karlson <endre.karlson@bouvet.no>
@ -15,11 +14,16 @@
# License for the specific language governing permissions and limitations
# under the License.
import sys
from designate.openstack.common import log as logging
from designate import utils
from designate.manage import DesignateShell
# TODO: Sypport passing --config-file and --config-dir to read_config
utils.read_config('designate', [])
shell = DesignateShell()
sys.exit(shell.run(sys.argv[1:]))
def main():
# TODO(kiall): Support passing --config-file and --config-dir to
# read_config
utils.read_config('designate', [])
logging.setup('designate')
shell = DesignateShell()
sys.exit(shell.run(sys.argv[1:]))

21
bin/designate-sink → designate/cmd/sink.py Executable file → Normal file
View File

@ -1,7 +1,6 @@
#!/usr/bin/env python
# Copyright 2012 Managed I.T.
# Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# Author: Kiall Mac Innes <kiall@managedit.ie>
# Author: Kiall Mac Innes <kiall@hp.com>
#
# 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
@ -15,19 +14,19 @@
# License for the specific language governing permissions and limitations
# under the License.
import sys
import eventlet
from oslo.config import cfg
from designate.openstack.common import log as logging
from designate.openstack.common import service
from designate import utils
from designate.sink import service as sink_service
eventlet.monkey_patch()
CONF = cfg.CONF
CONF.import_opt('workers', 'designate.sink', group='service:sink')
utils.read_config('designate', sys.argv)
logging.setup('designate')
launcher = service.launch(sink_service.Service(),
cfg.CONF['service:sink'].workers)
launcher.wait()
def main():
utils.read_config('designate', sys.argv)
logging.setup('designate')
launcher = service.launch(sink_service.Service(),
CONF['service:sink'].workers)
launcher.wait()

View File

@ -28,14 +28,17 @@ setup-hooks =
packages =
designate
scripts =
bin/designate-agent
bin/designate-api
bin/designate-central
bin/designate-manage
bin/designate-rootwrap
bin/designate-sink
bin/designate-rpc-zmq-receiver
[entry_points]
console_scripts =
designate-agent = designate.cmd.agent:main
designate-api = designate.cmd.api:main
designate-central = designate.cmd.central:main
designate-manage = designate.cmd.manage:main
designate-sink = designate.cmd.sink:main
designate.api.v1 =
domains = designate.api.v1.domains:blueprint
limits = designate.api.v1.limits:blueprint