Pass version and description into oslo setup

Following setup adds version of monasca-persister
into oslo setup

Change-Id: I22aaaac2fcfdd2849b44a95979c23473488dd2c3
This commit is contained in:
Tomasz Trębski 2017-03-28 08:45:46 +02:00
parent de9efed226
commit baece23027
2 changed files with 29 additions and 3 deletions

View File

@ -32,6 +32,7 @@ from oslo_config import cfg
from oslo_log import log
from monasca_persister.repositories import persister
from monasca_persister import version
LOG = log.getLogger(__name__)
@ -132,14 +133,21 @@ def start_process(respository, kafka_config):
m_persister.run()
def main():
def _init_config():
log.register_options(cfg.CONF)
log.set_defaults()
cfg.CONF(sys.argv[1:], project='monasca', prog='persister')
log.setup(cfg.CONF, "monasca-persister")
cfg.CONF(prog='persister',
project='monasca',
version=version.version_str,
description='Persists metrics & alarm history in TSDB')
log.setup(cfg.CONF, 'monasca-persister', version=version.version_str)
def main():
"""Start persister."""
_init_config()
metric_repository = simport.load(cfg.CONF.repositories.metrics_driver)
alarm_state_history_repository = simport.load(cfg.CONF.repositories.alarm_state_history_driver)

View File

@ -0,0 +1,18 @@
# Copyright 2017 FUJITSU LIMITED
#
# 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 pbr.version
version_info = pbr.version.VersionInfo('monasca-persister')
version_str = version_info.version_string()