Merge "Update oslo.notifier and always register options"
This commit is contained in:
commit
3e4e007685
@ -43,7 +43,6 @@ from oslo.config import cfg
|
||||
from heat.openstack.common import log as logging
|
||||
from heat.openstack.common import service
|
||||
|
||||
from heat.common import config
|
||||
from heat.db import api as db_api
|
||||
from heat.rpc import api as rpc_api
|
||||
|
||||
@ -64,7 +63,6 @@ if __name__ == '__main__':
|
||||
from heat.engine import service as engine
|
||||
|
||||
db_api.configure()
|
||||
config.register_engine_opts()
|
||||
srv = engine.EngineService(cfg.CONF.host, rpc_api.ENGINE_TOPIC)
|
||||
launcher = service.launch(srv)
|
||||
launcher.wait()
|
||||
|
@ -12,7 +12,3 @@
|
||||
# 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 heat.common import config
|
||||
|
||||
config.register_api_opts()
|
||||
|
@ -38,10 +38,6 @@ paste_deploy_opts = [
|
||||
help="The API paste config file to use")]
|
||||
|
||||
|
||||
bind_opts = [
|
||||
cfg.IntOpt('bind_port', default=8000),
|
||||
cfg.StrOpt('bind_host', default='127.0.0.1')]
|
||||
|
||||
service_opts = [
|
||||
cfg.IntOpt('report_interval',
|
||||
default=10,
|
||||
@ -113,38 +109,23 @@ rpc_opts = [
|
||||
'This can be an opaque identifier.'
|
||||
'It is not necessarily a hostname, FQDN, or IP address.')]
|
||||
|
||||
cfg.CONF.register_opts(db_opts)
|
||||
cfg.CONF.register_opts(engine_opts)
|
||||
cfg.CONF.register_opts(service_opts)
|
||||
cfg.CONF.register_opts(rpc_opts)
|
||||
cfg.CONF.register_group(paste_deploy_group)
|
||||
cfg.CONF.register_opts(paste_deploy_opts, group=paste_deploy_group)
|
||||
|
||||
def register_api_opts():
|
||||
cfg.CONF.register_opts(bind_opts)
|
||||
cfg.CONF.register_opts(rpc_opts)
|
||||
|
||||
def rpc_set_default():
|
||||
rpc.set_defaults(control_exchange='heat')
|
||||
|
||||
|
||||
def register_db_opts():
|
||||
cfg.CONF.register_opts(db_opts)
|
||||
|
||||
|
||||
def register_engine_opts():
|
||||
cfg.CONF.register_opts(engine_opts)
|
||||
cfg.CONF.register_opts(service_opts)
|
||||
cfg.CONF.register_opts(rpc_opts)
|
||||
rpc.set_defaults(control_exchange='heat')
|
||||
|
||||
|
||||
def _register_paste_deploy_opts():
|
||||
"""
|
||||
Idempotent registration of paste_deploy option group
|
||||
"""
|
||||
cfg.CONF.register_group(paste_deploy_group)
|
||||
cfg.CONF.register_opts(paste_deploy_opts, group=paste_deploy_group)
|
||||
|
||||
|
||||
def _get_deployment_flavor():
|
||||
"""
|
||||
Retrieve the paste_deploy.flavor config item, formatted appropriately
|
||||
for appending to the application name.
|
||||
"""
|
||||
_register_paste_deploy_opts()
|
||||
flavor = cfg.CONF.paste_deploy.flavor
|
||||
return '' if not flavor else ('-' + flavor)
|
||||
|
||||
@ -154,7 +135,6 @@ def _get_deployment_config_file():
|
||||
Retrieve the deployment_config_file config item, formatted as an
|
||||
absolute pathname.
|
||||
"""
|
||||
_register_paste_deploy_opts()
|
||||
config_path = cfg.CONF.find_file(
|
||||
cfg.CONF.paste_deploy['api_paste_config'])
|
||||
if config_path is None:
|
||||
|
@ -58,13 +58,19 @@ bind_opts = [
|
||||
cfg.IntOpt('bind_port'),
|
||||
]
|
||||
|
||||
cfg.CONF.register_opts(bind_opts)
|
||||
|
||||
socket_opts = [
|
||||
cfg.IntOpt('backlog', default=4096),
|
||||
cfg.StrOpt('cert_file'),
|
||||
cfg.StrOpt('key_file'),
|
||||
]
|
||||
|
||||
workers_opt = cfg.IntOpt('workers', default=0)
|
||||
cfg.CONF.register_opts(socket_opts)
|
||||
|
||||
workers_opts = cfg.IntOpt('workers', default=0)
|
||||
|
||||
cfg.CONF.register_opt(workers_opts)
|
||||
|
||||
|
||||
class WritableLogger(object):
|
||||
@ -178,7 +184,6 @@ class Server(object):
|
||||
|
||||
self.application = application
|
||||
self.sock = get_socket(conf, default_port)
|
||||
conf.register_opt(workers_opt)
|
||||
|
||||
self.logger = logging.getLogger('eventlet.wsgi.server')
|
||||
|
||||
|
@ -28,7 +28,6 @@ supported backend.
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from heat.common import config
|
||||
from heat.db import utils
|
||||
|
||||
SQL_CONNECTION = 'sqlite://'
|
||||
@ -38,14 +37,19 @@ db_opts = [
|
||||
default='sqlalchemy',
|
||||
help='The backend to use for db')]
|
||||
|
||||
cfg.CONF.register_opts(db_opts)
|
||||
|
||||
IMPL = utils.LazyPluggable('db_backend',
|
||||
sqlalchemy='heat.db.sqlalchemy.api')
|
||||
|
||||
|
||||
cfg.CONF.import_opt('sql_connection', 'heat.common.config')
|
||||
cfg.CONF.import_opt('sql_idle_timeout', 'heat.common.config')
|
||||
|
||||
|
||||
def configure():
|
||||
global SQL_CONNECTION
|
||||
global SQL_IDLE_TIMEOUT
|
||||
config.register_db_opts()
|
||||
SQL_CONNECTION = cfg.CONF.sql_connection
|
||||
SQL_IDLE_TIMEOUT = cfg.CONF.sql_idle_timeout
|
||||
|
||||
|
@ -51,15 +51,14 @@ def initialise():
|
||||
if _initialized:
|
||||
return
|
||||
import sys
|
||||
from heat.common import config
|
||||
from heat.common import plugin_loader
|
||||
|
||||
config.register_engine_opts()
|
||||
|
||||
_register_modules(plugin_loader.load_modules(sys.modules[__name__]))
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
cfg.CONF.import_opt('plugin_dirs', 'heat.common.config')
|
||||
|
||||
plugin_pkg = plugin_loader.create_subpackage(cfg.CONF.plugin_dirs,
|
||||
'heat.engine')
|
||||
_register_modules(plugin_loader.load_modules(plugin_pkg, True))
|
||||
|
@ -13,12 +13,13 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import socket
|
||||
import uuid
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from heat.openstack.common import context
|
||||
from heat.openstack.common.gettextutils import _
|
||||
from heat.openstack.common.gettextutils import _ # noqa
|
||||
from heat.openstack.common import importutils
|
||||
from heat.openstack.common import jsonutils
|
||||
from heat.openstack.common import log as logging
|
||||
@ -35,7 +36,7 @@ notifier_opts = [
|
||||
default='INFO',
|
||||
help='Default notification level for outgoing notifications'),
|
||||
cfg.StrOpt('default_publisher_id',
|
||||
default='$host',
|
||||
default=None,
|
||||
help='Default publisher_id for outgoing notifications'),
|
||||
]
|
||||
|
||||
@ -74,7 +75,7 @@ def notify_decorator(name, fn):
|
||||
|
||||
ctxt = context.get_context_from_function_and_args(fn, args, kwarg)
|
||||
notify(ctxt,
|
||||
CONF.default_publisher_id,
|
||||
CONF.default_publisher_id or socket.gethostname(),
|
||||
name,
|
||||
CONF.default_notification_level,
|
||||
body)
|
||||
@ -84,7 +85,10 @@ def notify_decorator(name, fn):
|
||||
|
||||
def publisher_id(service, host=None):
|
||||
if not host:
|
||||
host = CONF.host
|
||||
try:
|
||||
host = CONF.host
|
||||
except AttributeError:
|
||||
host = CONF.default_publisher_id or socket.gethostname()
|
||||
return "%s.%s" % (service, host)
|
||||
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
from oslo.config import cfg
|
||||
|
||||
from heat.openstack.common import context as req_context
|
||||
from heat.openstack.common.gettextutils import _
|
||||
from heat.openstack.common.gettextutils import _ # noqa
|
||||
from heat.openstack.common import log as logging
|
||||
from heat.openstack.common import rpc
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
from oslo.config import cfg
|
||||
|
||||
from heat.openstack.common import context as req_context
|
||||
from heat.openstack.common.gettextutils import _
|
||||
from heat.openstack.common.gettextutils import _ # noqa
|
||||
from heat.openstack.common import log as logging
|
||||
from heat.openstack.common import rpc
|
||||
|
||||
|
@ -22,7 +22,6 @@ from testtools import matchers
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from heat.common import config
|
||||
from heat.common import context
|
||||
from heat.engine import environment
|
||||
from heat.common import exception
|
||||
@ -576,7 +575,6 @@ class stackServiceTest(HeatTestCase):
|
||||
def setUp(self):
|
||||
super(stackServiceTest, self).setUp()
|
||||
|
||||
config.register_engine_opts()
|
||||
self.username = 'stack_service_test_user'
|
||||
self.tenant = 'stack_service_test_tenant'
|
||||
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
import mox
|
||||
|
||||
from heat.common import config
|
||||
from heat.common import context
|
||||
from heat.common import heat_keystoneclient
|
||||
from heat.tests.common import HeatTestCase
|
||||
@ -26,7 +25,6 @@ class KeystoneClientTest(HeatTestCase):
|
||||
def setUp(self):
|
||||
super(KeystoneClientTest, self).setUp()
|
||||
# load config so role checking doesn't barf
|
||||
config.register_engine_opts()
|
||||
# mock the internal keystone client and its authentication
|
||||
self.m.StubOutClassWithMocks(heat_keystoneclient.kc, "Client")
|
||||
self.mock_ks_client = heat_keystoneclient.kc.Client(
|
||||
|
@ -18,7 +18,6 @@ import re
|
||||
|
||||
from oslo.config import cfg
|
||||
from heat.common import exception
|
||||
from heat.common import config
|
||||
from heat.common import template_format
|
||||
from heat.engine import clients
|
||||
from heat.engine import scheduler
|
||||
@ -105,7 +104,6 @@ lb_template_nokey = '''
|
||||
class LoadBalancerTest(HeatTestCase):
|
||||
def setUp(self):
|
||||
super(LoadBalancerTest, self).setUp()
|
||||
config.register_engine_opts()
|
||||
self.fc = fakes.FakeClient()
|
||||
self.m.StubOutWithMock(clients.OpenStackClients, 'nova')
|
||||
self.m.StubOutWithMock(self.fc.servers, 'create')
|
||||
|
@ -23,7 +23,6 @@ from oslo.config import cfg
|
||||
import stubout
|
||||
import testtools
|
||||
|
||||
from heat.common import config
|
||||
from heat.common import context
|
||||
from heat.common import identifier
|
||||
from heat.rpc import api as rpc_api
|
||||
@ -34,7 +33,6 @@ from heat.openstack.common import rpc
|
||||
class EngineRpcAPITestCase(testtools.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
config.register_engine_opts()
|
||||
self.context = context.get_admin_context()
|
||||
cfg.CONF.set_default('rpc_backend',
|
||||
'heat.openstack.common.rpc.impl_fake')
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from heat.common import config
|
||||
from heat.common import exception
|
||||
from heat.common import template_format
|
||||
from heat.engine import resource
|
||||
@ -92,7 +91,6 @@ user_policy_template = '''
|
||||
class UserPolicyTestCase(HeatTestCase):
|
||||
def setUp(self):
|
||||
super(UserPolicyTestCase, self).setUp()
|
||||
config.register_engine_opts()
|
||||
username = utils.PhysName('test_stack', 'CfnUser')
|
||||
self.fc = fakes.FakeKeystoneClient(username=username)
|
||||
cfg.CONF.set_default('heat_stack_user_role', 'stack_user_role')
|
||||
|
@ -32,7 +32,6 @@ from heat.engine import parser
|
||||
from heat.engine import resource
|
||||
from heat.engine import scheduler
|
||||
from heat.engine.resources import wait_condition as wc
|
||||
from heat.common import config
|
||||
from heat.common import context
|
||||
|
||||
test_template_waitcondition = '''
|
||||
@ -94,7 +93,6 @@ class WaitConditionTest(HeatTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(WaitConditionTest, self).setUp()
|
||||
config.register_engine_opts()
|
||||
setup_dummy_db()
|
||||
self.m.StubOutWithMock(wc.WaitConditionHandle,
|
||||
'get_status')
|
||||
@ -373,7 +371,6 @@ class WaitConditionTest(HeatTestCase):
|
||||
class WaitConditionHandleTest(HeatTestCase):
|
||||
def setUp(self):
|
||||
super(WaitConditionHandleTest, self).setUp()
|
||||
config.register_engine_opts()
|
||||
cfg.CONF.set_default('heat_waitcondition_server_url',
|
||||
'http://127.0.0.1:8000/v1/waitcondition')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user