diff --git a/bin/ceilometer-dbsync b/bin/ceilometer-dbsync deleted file mode 100755 index f7926367b..000000000 --- a/bin/ceilometer-dbsync +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env python -# -*- encoding: utf-8 -*- -# -# Author: John Tran -# Author: Julien Danjou -# -# 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() diff --git a/ceilometer/storage/__init__.py b/ceilometer/storage/__init__.py index 322aff280..40e0252e8 100644 --- a/ceilometer/storage/__init__.py +++ b/ceilometer/storage/__init__.py @@ -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() diff --git a/setup.cfg b/setup.cfg index 1a97e5608..d9cadf763 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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 diff --git a/tests/test_bin.py b/tests/test_bin.py index 7bf897096..d93b9f5e2 100644 --- a/tests/test_bin.py +++ b/tests/test_bin.py @@ -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)