diff --git a/os_namos/common/config.py b/os_namos/common/config.py deleted file mode 100644 index afa6966..0000000 --- a/os_namos/common/config.py +++ /dev/null @@ -1,36 +0,0 @@ -# -*- coding: utf-8 -*- - -# 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. - -from oslo_config import cfg -from oslo_log import log as logging - -import os_namos # noqa - -PROJECT_NAME = 'namos' -VERSION = '0.0.1' -MESSAGE_QUEUE_CONDUCTOR_TOPIC = '%s.conductor' % PROJECT_NAME -CONF = cfg.CONF - - -def init_conf(prog): - CONF(project=PROJECT_NAME, - version=VERSION, - prog=prog) - - -def init_log(project=PROJECT_NAME): - logging.register_options(cfg.CONF) - logging.setup(cfg.CONF, - project, - version=VERSION) diff --git a/os_namos/common/rpcapi.py b/os_namos/common/rpcapi.py index 9609e18..e55945e 100644 --- a/os_namos/common/rpcapi.py +++ b/os_namos/common/rpcapi.py @@ -21,7 +21,6 @@ import json import oslo_messaging from oslo_messaging import RemoteError -from os_namos.common import config # noqa from os_namos.common import exception as namos_exception from os_namos.common import messaging as rpc @@ -54,7 +53,7 @@ class ConductorAPI(object): } ) - oslo_messaging.set_transport_defaults(project) + oslo_messaging.set_transport_defaults('namos') self.client = rpc.get_rpc_client(version=self.RPC_API_VERSION, topic=self.topic) diff --git a/os_namos/sync.py b/os_namos/sync.py index 75ea614..be09550 100644 --- a/os_namos/sync.py +++ b/os_namos/sync.py @@ -68,8 +68,13 @@ def collect_registration_info(): self = cfg.CONF def normalize_type(type): - if str(type).find('function'): + try: + if str(type).find('function'): + return 'String' + except TypeError: # noqa + # TODO(mrkanag) why this type error occurs? return 'String' + return type def get_host(): @@ -139,20 +144,29 @@ def update_config(config): pass +# TODO(mrkanag) Remove this before production ! if __name__ == '__main__': - # TODO(mrkanag) Remove this before production ! - from os_namos.common import config + from oslo_config import cfg + from oslo_log import log as logging - config.init_log() - config.init_conf('test-run') + import os_namos # noqa - reg_info = RegistrationInfo( - host='namos_development', - project_name=config.PROJECT_NAME, - prog_name='sync', - config_file_list=['/etc/namos/namos.conf'], - config_dict={}) + PROJECT_NAME = 'namos' + VERSION = '0.0.1' + CONF = cfg.CONF - print (reg_info.__dict__) + def init_conf(prog): + CONF(project=PROJECT_NAME, + version=VERSION, + prog=prog) - print (register_myself(reg_info)) + def init_log(project=PROJECT_NAME): + logging.register_options(cfg.CONF) + logging.setup(cfg.CONF, + project, + version=VERSION) + + init_log() + init_conf('test-run') + + print (register_myself()) diff --git a/setup.cfg b/setup.cfg index c7b9a33..94aaec1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -21,7 +21,7 @@ classifier = [files] packages = - os-namos + os_namos [build_sphinx] source-dir = doc/source @@ -33,10 +33,10 @@ upload-dir = doc/build/html [compile_catalog] directory = os-namos/locale -domain = os-namos +domain = os_namos [update_catalog] -domain = os-namos +domain = os_namos output_dir = os-namos/locale input_file = os-namos/locale/os-namos.pot