FIX-1234 Make namos centric rpc communication
Change-Id: I0f8c23d34ada8cbf52d2a8796db9ff1e9286f4d9
This commit is contained in:
parent
4e04023955
commit
580db3e458
|
@ -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)
|
|
|
@ -21,7 +21,6 @@ import json
|
||||||
import oslo_messaging
|
import oslo_messaging
|
||||||
from oslo_messaging import RemoteError
|
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 exception as namos_exception
|
||||||
from os_namos.common import messaging as rpc
|
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,
|
self.client = rpc.get_rpc_client(version=self.RPC_API_VERSION,
|
||||||
topic=self.topic)
|
topic=self.topic)
|
||||||
|
|
|
@ -68,8 +68,13 @@ def collect_registration_info():
|
||||||
self = cfg.CONF
|
self = cfg.CONF
|
||||||
|
|
||||||
def normalize_type(type):
|
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 'String'
|
||||||
|
|
||||||
return type
|
return type
|
||||||
|
|
||||||
def get_host():
|
def get_host():
|
||||||
|
@ -139,20 +144,29 @@ def update_config(config):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
# TODO(mrkanag) Remove this before production !
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# TODO(mrkanag) Remove this before production !
|
from oslo_config import cfg
|
||||||
from os_namos.common import config
|
from oslo_log import log as logging
|
||||||
|
|
||||||
config.init_log()
|
import os_namos # noqa
|
||||||
config.init_conf('test-run')
|
|
||||||
|
|
||||||
reg_info = RegistrationInfo(
|
PROJECT_NAME = 'namos'
|
||||||
host='namos_development',
|
VERSION = '0.0.1'
|
||||||
project_name=config.PROJECT_NAME,
|
CONF = cfg.CONF
|
||||||
prog_name='sync',
|
|
||||||
config_file_list=['/etc/namos/namos.conf'],
|
|
||||||
config_dict={})
|
|
||||||
|
|
||||||
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())
|
||||||
|
|
|
@ -21,7 +21,7 @@ classifier =
|
||||||
|
|
||||||
[files]
|
[files]
|
||||||
packages =
|
packages =
|
||||||
os-namos
|
os_namos
|
||||||
|
|
||||||
[build_sphinx]
|
[build_sphinx]
|
||||||
source-dir = doc/source
|
source-dir = doc/source
|
||||||
|
@ -33,10 +33,10 @@ upload-dir = doc/build/html
|
||||||
|
|
||||||
[compile_catalog]
|
[compile_catalog]
|
||||||
directory = os-namos/locale
|
directory = os-namos/locale
|
||||||
domain = os-namos
|
domain = os_namos
|
||||||
|
|
||||||
[update_catalog]
|
[update_catalog]
|
||||||
domain = os-namos
|
domain = os_namos
|
||||||
output_dir = os-namos/locale
|
output_dir = os-namos/locale
|
||||||
input_file = os-namos/locale/os-namos.pot
|
input_file = os-namos/locale/os-namos.pot
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue