Use console scripts for ceilometer-dbsync

Blueprint: setuptools-console-scripts

Change-Id: Ibd63589f09c610d86b1c097ba52ea2f24c5d026e
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2013-05-29 13:34:20 +02:00
parent d0a5d0990e
commit 7183fd5970
4 changed files with 11 additions and 35 deletions

View File

@ -1,33 +0,0 @@
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# Author: John Tran <jhtran@att.com>
# Author: Julien Danjou <julien@danjou.info>
#
# 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.
"""Run storage database migration.
"""
import sys
from oslo.config import cfg
from ceilometer.openstack.common import gettextutils
gettextutils.install('ceilometer')
from ceilometer import service
from ceilometer import storage
if __name__ == '__main__':
service.prepare_service(sys.argv)
storage.get_connection(cfg.CONF).upgrade()

View File

@ -23,9 +23,12 @@ import urlparse
from oslo.config import cfg
from stevedore import driver
import sys
from ceilometer.openstack.common import gettextutils
from ceilometer.openstack.common import log
from ceilometer import utils
from ceilometer import service
LOG = log.getLogger(__name__)
@ -118,3 +121,9 @@ class EventFilter(object):
self.end = utils.sanitize_timestamp(end)
self.event_name = event_name
self.traits = traits
def dbsync():
gettextutils.install('ceilometer')
service.prepare_service(sys.argv)
get_connection(cfg.CONF).upgrade()

View File

@ -28,7 +28,6 @@ packages =
ceilometer
scripts =
bin/ceilometer-api
bin/ceilometer-dbsync
[entry_points]
ceilometer.collector =
@ -89,6 +88,7 @@ paste.filter_factory =
console_scripts =
ceilometer-agent-central = ceilometer.central.manager:agent_central
ceilometer-agent-compute = ceilometer.compute.manager:agent_compute
ceilometer-dbsync = ceilometer.storage:dbsync
ceilometer-collector = ceilometer.collector.service:collector
ceilometer-collector-udp = ceilometer.collector.service:udp_collector

View File

@ -36,7 +36,7 @@ class BinDbsyncTestCase(base.TestCase):
tmp.write("connection=log://localhost\n")
def test_dbsync_run(self):
subp = subprocess.Popen([self.path_get('bin/ceilometer-dbsync'),
subp = subprocess.Popen(['ceilometer-dbsync',
"--config-file=%s" % self.tempfile])
self.assertEqual(subp.wait(), 0)