-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
-#
-# 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.
-
-'''Database abstraction for Heat.'''
-
-from heat.common import config
-
-config.register_db_opts()
-
-from heat.db.api import *
from oslo.config import cfg
+from heat.common import config
from heat.db import utils
SQL_CONNECTION = 'sqlite://'
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
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-#
-# 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 heat.common import config
-
-config.register_engine_opts()
-
-from heat import db # pyflakes_bypass register DB options
from heat.engine import dependencies
from heat.common import identifier
from heat.engine import resource
+from heat.engine import resources
from heat.engine import template
from heat.engine import timestamp
from heat.engine.parameters import Parameters
self.timeout_mins = timeout_mins
self.disable_rollback = disable_rollback
+ resources.initialise()
+
if parameters is None:
parameters = Parameters(self.name, self.t)
self.parameters = parameters
_register_resources(itertools.chain.from_iterable(resource_lists))
-def _initialise():
+_initialized = False
+
+
+def initialise():
+ global _initialized
+ 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
plugin_pkg = plugin_loader.create_subpackage(cfg.CONF.plugin_dirs,
'heat.engine')
_register_modules(plugin_loader.load_modules(plugin_pkg, True))
-
-
-_initialise()
+ _initialized = True
from oslo.config import cfg
import webob
+from heat.common import config
from heat.common import context
from heat.db import api as db_api
from heat.engine import api
super(EngineService, self).__init__(host, topic)
# stg == "Stack Thread Groups"
self.stg = {}
+ config.register_engine_opts()
def _start_in_thread(self, stack_id, func, *args, **kwargs):
if stack_id not in self.stg:
from heat.common import exception
from heat.tests.v1_1 import fakes
import heat.engine.api as engine_api
-import heat.db as db_api
+import heat.db.api as db_api
from heat.common import identifier
from heat.common import template_format
from heat.engine import parser
import unittest
from heat.common import context
-import heat.db as db_api
+import heat.db.api as db_api
from heat.engine import parser
from heat.engine import resource
from heat.engine import template
from oslo.config import cfg
from heat.common import exception
+from heat.common import config
from heat.common import context
from heat.common import template_format
from heat.engine import parser
@attr(speed='fast')
class LoadBalancerTest(unittest.TestCase):
def setUp(self):
+ config.register_engine_opts()
self.m = mox.Mox()
self.fc = fakes.FakeClient()
self.m.StubOutWithMock(lb.LoadBalancer, 'nova')
from heat.tests.utils import stack_delete_after
from heat.tests import generic_resource as generic_rsrc
-import heat.db as db_api
+import heat.db.api as db_api
def join(raw):
import stubout
import unittest
+from heat.common import config
from heat.common import context
from heat.common import identifier
from heat.rpc import client as rpc_client
class EngineRpcAPITestCase(unittest.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 novaclient.v1_1 import security_groups as nova_sg
from novaclient.v1_1 import security_group_rules as nova_sgr
-
NovaSG = collections.namedtuple('NovaSG',
' '.join([
'name',
from nose.plugins.attrib import attr
from oslo.config import cfg
+from heat.common import config
from heat.common import context
from heat.common import exception
from heat.common import template_format
@attr(speed='fast')
class UserTest(unittest.TestCase):
def setUp(self):
+ config.register_engine_opts()
self.m = mox.Mox()
self.fc = fakes.FakeKeystoneClient(username='test_stack.CfnUser')
cfg.CONF.set_default('heat_stack_user_role', 'stack_user_role')
@attr(speed='fast')
class AccessKeyTest(unittest.TestCase):
def setUp(self):
+ config.register_engine_opts()
self.m = mox.Mox()
self.fc = fakes.FakeKeystoneClient(username='test_stack.CfnUser')
cfg.CONF.set_default('heat_stack_user_role', 'stack_user_role')
from heat.common import template_format
from heat.engine.resources import instance as instances
from heat.engine import service
-import heat.db as db_api
+import heat.db.api as db_api
from heat.engine import parser
test_template_volumeattach = '''
from heat.tests import fakes
from heat.tests.utils import stack_delete_after
-import heat.db as db_api
+import heat.db.api as db_api
from heat.common import template_format
from heat.common import identifier
from heat.engine import parser
from heat.engine.resources import wait_condition as wc
+from heat.common import config
from heat.common import context
test_template_waitcondition = '''
@attr(speed='slow')
class WaitConditionTest(unittest.TestCase):
def setUp(self):
+ config.register_engine_opts()
self.m = mox.Mox()
self.m.StubOutWithMock(wc.WaitConditionHandle,
'get_status')
@attr(speed='fast')
class WaitConditionHandleTest(unittest.TestCase):
def setUp(self):
+ config.register_engine_opts()
self.m = mox.Mox()
cfg.CONF.set_default('heat_waitcondition_server_url',
'http://127.0.0.1:8000/v1/waitcondition')
from nose.plugins.attrib import attr
import unittest
from heat.common import context
-import heat.db as db_api
+import heat.db.api as db_api
from heat.openstack.common import timeutils
from heat.engine import watchrule