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
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()
# 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()
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,
'This can be an opaque identifier.'
'It is not necessarily a hostname, FQDN, or IP address.')]
-
-def register_api_opts():
- cfg.CONF.register_opts(bind_opts)
- cfg.CONF.register_opts(rpc_opts)
- rpc.set_defaults(control_exchange='heat')
-
-
-def register_db_opts():
- cfg.CONF.register_opts(db_opts)
+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_engine_opts():
- cfg.CONF.register_opts(engine_opts)
- cfg.CONF.register_opts(service_opts)
- cfg.CONF.register_opts(rpc_opts)
+def rpc_set_default():
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)
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:
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):
self.application = application
self.sock = get_socket(conf, default_port)
- conf.register_opt(workers_opt)
self.logger = logging.getLogger('eventlet.wsgi.server')
from oslo.config import cfg
-from heat.common import config
from heat.db import utils
SQL_CONNECTION = 'sqlite://'
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
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))
# 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
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'),
]
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)
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)
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
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
import mox
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
def setUp(self):
super(stackServiceTest, self).setUp()
- config.register_engine_opts()
self.username = 'stack_service_test_user'
self.tenant = 'stack_service_test_tenant'
import mox
-from heat.common import config
from heat.common import context
from heat.common import heat_keystoneclient
from heat.tests.common import 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(
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
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')
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
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')
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
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')
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 = '''
def setUp(self):
super(WaitConditionTest, self).setUp()
- config.register_engine_opts()
setup_dummy_db()
self.m.StubOutWithMock(wc.WaitConditionHandle,
'get_status')
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')