diff --git a/heat/cmd/manage.py b/heat/cmd/manage.py index 6f1b6e1f5c..7d1465deb2 100644 --- a/heat/cmd/manage.py +++ b/heat/cmd/manage.py @@ -26,8 +26,7 @@ from heat.common import exception from heat.common.i18n import _ from heat.common import messaging from heat.common import service_utils -from heat.db import api as db_api -from heat.db import utils +from heat.db.sqlalchemy import api as db_api from heat.objects import service as service_objects from heat.rpc import client as rpc_client from heat import version @@ -131,10 +130,10 @@ def do_migrate(): def purge_deleted(): """Remove database records that have been previously soft deleted.""" - utils.purge_deleted(CONF.command.age, - CONF.command.granularity, - CONF.command.project_id, - CONF.command.batch_size) + db_api.purge_deleted(CONF.command.age, + CONF.command.granularity, + CONF.command.project_id, + CONF.command.batch_size) def do_crypt_parameters_and_properties(): @@ -142,10 +141,10 @@ def do_crypt_parameters_and_properties(): ctxt = context.get_admin_context() prev_encryption_key = CONF.command.previous_encryption_key if CONF.command.crypt_operation == "encrypt": - utils.encrypt_parameters_and_properties( + db_api.encrypt_parameters_and_properties( ctxt, prev_encryption_key, CONF.command.verbose_update_params) elif CONF.command.crypt_operation == "decrypt": - utils.decrypt_parameters_and_properties( + db_api.decrypt_parameters_and_properties( ctxt, prev_encryption_key, CONF.command.verbose_update_params) diff --git a/heat/common/context.py b/heat/common/context.py index 078b7d01ac..bd9aa1dcc9 100644 --- a/heat/common/context.py +++ b/heat/common/context.py @@ -31,7 +31,7 @@ from heat.common import exception from heat.common.i18n import _LE, _LW from heat.common import policy from heat.common import wsgi -from heat.db import api as db_api +from heat.db.sqlalchemy import api as db_api from heat.engine import clients LOG = logging.getLogger(__name__) diff --git a/heat/db/api.py b/heat/db/api.py deleted file mode 100644 index d388681e9b..0000000000 --- a/heat/db/api.py +++ /dev/null @@ -1,470 +0,0 @@ -# -# 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. - -"""Interface for database access. - -Usage: - - >>> from heat import db - >>> db.event_get(context, event_id) - # Event object received - -The underlying driver is loaded. SQLAlchemy is currently the only -supported backend. -""" - -from oslo_config import cfg -from oslo_db import api - -CONF = cfg.CONF - - -_BACKEND_MAPPING = {'sqlalchemy': 'heat.db.sqlalchemy.api'} - -IMPL = api.DBAPI.from_config(CONF, backend_mapping=_BACKEND_MAPPING) - - -def get_engine(): - return IMPL.get_engine() - - -def get_session(): - return IMPL.get_session() - - -def raw_template_get(context, template_id): - return IMPL.raw_template_get(context, template_id) - - -def raw_template_create(context, values): - return IMPL.raw_template_create(context, values) - - -def raw_template_update(context, template_id, values): - return IMPL.raw_template_update(context, template_id, values) - - -def raw_template_delete(context, template_id): - return IMPL.raw_template_delete(context, template_id) - - -def raw_template_files_create(context, values): - return IMPL.raw_template_files_create(context, values) - - -def raw_template_files_get(context, tmpl_files_id): - return IMPL.raw_template_files_get(context, tmpl_files_id) - - -def resource_data_get_all(context, resource_id, data=None): - return IMPL.resource_data_get_all(context, resource_id, data) - - -def resource_data_get(context, resource_id, key): - return IMPL.resource_data_get(context, resource_id, key) - - -def resource_data_set(context, resource_id, key, value, redact=False): - return IMPL.resource_data_set(context, resource_id, key, value, - redact=redact) - - -def resource_data_get_by_key(context, resource_id, key): - return IMPL.resource_data_get_by_key(context, resource_id, key) - - -def resource_data_delete(context, resource_id, key): - """Remove a resource_data element associated to a resource.""" - return IMPL.resource_data_delete(context, resource_id, key) - - -def stack_tags_set(context, stack_id, tags): - return IMPL.stack_tags_set(context, stack_id, tags) - - -def stack_tags_delete(context, stack_id): - return IMPL.stack_tags_delete(context, stack_id) - - -def stack_tags_get(context, stack_id): - return IMPL.stack_tags_get(context, stack_id) - - -def resource_get(context, resource_id, refresh=False): - return IMPL.resource_get(context, resource_id, refresh=refresh) - - -def resource_get_all(context): - return IMPL.resource_get_all(context) - - -def resource_update(context, resource_id, values, atomic_key, - expected_engine_id=None): - return IMPL.resource_update(context, resource_id, values, atomic_key, - expected_engine_id) - - -def resource_update_and_save(context, resource_id, values): - return IMPL.resource_update_and_save(context, resource_id, values) - - -def resource_create(context, values): - return IMPL.resource_create(context, values) - - -def resource_delete(context, resource_id): - return IMPL.resource_delete(context, resource_id) - - -def resource_exchange_stacks(context, resource_id1, resource_id2): - return IMPL.resource_exchange_stacks(context, resource_id1, resource_id2) - - -def resource_get_all_by_stack(context, stack_id, filters=None): - return IMPL.resource_get_all_by_stack(context, stack_id, filters) - - -def resource_get_all_active_by_stack(context, stack_id): - return IMPL.resource_get_all_active_by_stack(context, stack_id) - - -def resource_get_all_by_root_stack(context, stack_id, filters=None): - return IMPL.resource_get_all_by_root_stack(context, stack_id, filters) - - -def engine_get_all_locked_by_stack(context, stack_id): - return IMPL.engine_get_all_locked_by_stack(context, stack_id) - - -def resource_purge_deleted(context, stack_id): - return IMPL.resource_purge_deleted(context, stack_id) - - -def resource_get_by_name_and_stack(context, resource_name, stack_id): - return IMPL.resource_get_by_name_and_stack(context, - resource_name, stack_id) - - -def resource_get_by_physical_resource_id(context, physical_resource_id): - return IMPL.resource_get_by_physical_resource_id(context, - physical_resource_id) - - -def resource_get_all_by_physical_resource_id(context, physical_resource_id): - return IMPL.resource_get_all_by_physical_resource_id(context, - physical_resource_id) - - -def stack_get(context, stack_id, show_deleted=False, eager_load=True): - return IMPL.stack_get(context, stack_id, show_deleted=show_deleted, - eager_load=eager_load) - - -def stack_get_status(context, stack_id): - return IMPL.stack_get_status(context, stack_id) - - -def stack_get_by_name_and_owner_id(context, stack_name, owner_id): - return IMPL.stack_get_by_name_and_owner_id(context, stack_name, - owner_id=owner_id) - - -def stack_get_by_name(context, stack_name): - return IMPL.stack_get_by_name(context, stack_name) - - -def stack_get_all(context, limit=None, sort_keys=None, marker=None, - sort_dir=None, filters=None, - show_deleted=False, show_nested=False, show_hidden=False, - tags=None, tags_any=None, not_tags=None, - not_tags_any=None, eager_load=False): - return IMPL.stack_get_all(context, limit, sort_keys, - marker, sort_dir, filters, - show_deleted, show_nested, show_hidden, - tags, tags_any, not_tags, not_tags_any, - eager_load=eager_load) - - -def stack_get_all_by_owner_id(context, owner_id): - return IMPL.stack_get_all_by_owner_id(context, owner_id) - - -def stack_get_all_by_root_owner_id(context, owner_id): - return IMPL.stack_get_all_by_root_owner_id(context, owner_id) - - -def stack_count_all(context, filters=None, - show_deleted=False, show_nested=False, show_hidden=False, - tags=None, tags_any=None, not_tags=None, - not_tags_any=None): - return IMPL.stack_count_all(context, filters=filters, - show_deleted=show_deleted, - show_nested=show_nested, - show_hidden=show_hidden, - tags=tags, - tags_any=tags_any, - not_tags=not_tags, - not_tags_any=not_tags_any) - - -def stack_create(context, values): - return IMPL.stack_create(context, values) - - -def stack_update(context, stack_id, values, exp_trvsl=None): - return IMPL.stack_update(context, stack_id, values, exp_trvsl=exp_trvsl) - - -def stack_delete(context, stack_id): - return IMPL.stack_delete(context, stack_id) - - -def stack_lock_create(context, stack_id, engine_id): - return IMPL.stack_lock_create(context, stack_id, engine_id) - - -def stack_lock_get_engine_id(context, stack_id): - return IMPL.stack_lock_get_engine_id(context, stack_id) - - -def stack_lock_steal(context, stack_id, old_engine_id, new_engine_id): - return IMPL.stack_lock_steal(context, stack_id, old_engine_id, - new_engine_id) - - -def stack_lock_release(context, stack_id, engine_id): - return IMPL.stack_lock_release(context, stack_id, engine_id) - - -def persist_state_and_release_lock(context, stack_id, engine_id, values): - return IMPL.persist_state_and_release_lock(context, stack_id, - engine_id, values) - - -def stack_get_root_id(context, stack_id): - return IMPL.stack_get_root_id(context, stack_id) - - -def stack_count_total_resources(context, stack_id): - return IMPL.stack_count_total_resources(context, stack_id) - - -def user_creds_create(context): - return IMPL.user_creds_create(context) - - -def user_creds_delete(context, user_creds_id): - return IMPL.user_creds_delete(context, user_creds_id) - - -def user_creds_get(context, user_creds_id): - return IMPL.user_creds_get(context, user_creds_id) - - -def event_get(context, event_id): - return IMPL.event_get(context, event_id) - - -def event_get_all(context): - return IMPL.event_get_all(context) - - -def event_get_all_by_tenant(context, limit=None, marker=None, - sort_keys=None, sort_dir=None, filters=None): - return IMPL.event_get_all_by_tenant(context, - limit=limit, - marker=marker, - sort_keys=sort_keys, - sort_dir=sort_dir, - filters=filters) - - -def event_get_all_by_stack(context, stack_id, limit=None, marker=None, - sort_keys=None, sort_dir=None, filters=None): - return IMPL.event_get_all_by_stack(context, stack_id, - limit=limit, - marker=marker, - sort_keys=sort_keys, - sort_dir=sort_dir, - filters=filters) - - -def event_count_all_by_stack(context, stack_id): - return IMPL.event_count_all_by_stack(context, stack_id) - - -def event_create(context, values): - return IMPL.event_create(context, values) - - -def watch_rule_get(context, watch_rule_id): - return IMPL.watch_rule_get(context, watch_rule_id) - - -def watch_rule_get_by_name(context, watch_rule_name): - return IMPL.watch_rule_get_by_name(context, watch_rule_name) - - -def watch_rule_get_all(context): - return IMPL.watch_rule_get_all(context) - - -def watch_rule_get_all_by_stack(context, stack_id): - return IMPL.watch_rule_get_all_by_stack(context, stack_id) - - -def watch_rule_create(context, values): - return IMPL.watch_rule_create(context, values) - - -def watch_rule_update(context, watch_id, values): - return IMPL.watch_rule_update(context, watch_id, values) - - -def watch_rule_delete(context, watch_id): - return IMPL.watch_rule_delete(context, watch_id) - - -def watch_data_create(context, values): - return IMPL.watch_data_create(context, values) - - -def watch_data_get_all(context): - return IMPL.watch_data_get_all(context) - - -def watch_data_get_all_by_watch_rule_id(context, watch_rule_id): - return IMPL.watch_data_get_all_by_watch_rule_id(context, watch_rule_id) - - -def software_config_create(context, values): - return IMPL.software_config_create(context, values) - - -def software_config_get(context, config_id): - return IMPL.software_config_get(context, config_id) - - -def software_config_get_all(context, limit=None, marker=None): - return IMPL.software_config_get_all(context, - limit=limit, - marker=marker) - - -def software_config_delete(context, config_id): - return IMPL.software_config_delete(context, config_id) - - -def software_deployment_create(context, values): - return IMPL.software_deployment_create(context, values) - - -def software_deployment_get(context, deployment_id): - return IMPL.software_deployment_get(context, deployment_id) - - -def software_deployment_get_all(context, server_id=None): - return IMPL.software_deployment_get_all(context, server_id) - - -def software_deployment_update(context, deployment_id, values): - return IMPL.software_deployment_update(context, deployment_id, values) - - -def software_deployment_delete(context, deployment_id): - return IMPL.software_deployment_delete(context, deployment_id) - - -def snapshot_create(context, values): - return IMPL.snapshot_create(context, values) - - -def snapshot_get(context, snapshot_id): - return IMPL.snapshot_get(context, snapshot_id) - - -def snapshot_get_by_stack(context, snapshot_id, stack): - return IMPL.snapshot_get_by_stack(context, snapshot_id, stack) - - -def snapshot_update(context, snapshot_id, values): - return IMPL.snapshot_update(context, snapshot_id, values) - - -def snapshot_delete(context, snapshot_id): - return IMPL.snapshot_delete(context, snapshot_id) - - -def snapshot_get_all(context, stack_id): - return IMPL.snapshot_get_all(context, stack_id) - - -def service_create(context, values): - return IMPL.service_create(context, values) - - -def service_update(context, service_id, values): - return IMPL.service_update(context, service_id, values) - - -def service_delete(context, service_id, soft_delete=True): - return IMPL.service_delete(context, service_id, soft_delete) - - -def service_get(context, service_id): - return IMPL.service_get(context, service_id) - - -def service_get_all(context): - return IMPL.service_get_all(context) - - -def service_get_all_by_args(context, host, binary, hostname): - return IMPL.service_get_all_by_args(context, host, binary, hostname) - - -def sync_point_delete_all_by_stack_and_traversal(context, stack_id, - traversal_id): - return IMPL.sync_point_delete_all_by_stack_and_traversal(context, - stack_id, - traversal_id) - - -def sync_point_create(context, values): - return IMPL.sync_point_create(context, values) - - -def sync_point_get(context, entity_id, traversal_id, is_update): - return IMPL.sync_point_get(context, entity_id, traversal_id, is_update) - - -def sync_point_update_input_data(context, entity_id, - traversal_id, is_update, atomic_key, - input_data): - return IMPL.sync_point_update_input_data(context, entity_id, - traversal_id, is_update, - atomic_key, input_data) - - -def db_sync(engine, version=None): - """Migrate the database to `version` or the most recent version.""" - return IMPL.db_sync(engine, version=version) - - -def db_version(engine): - """Display the current database version.""" - return IMPL.db_version(engine) - - -def reset_stack_status(context, stack_id): - return IMPL.reset_stack_status(context, stack_id) diff --git a/heat/db/sqlalchemy/api.py b/heat/db/sqlalchemy/api.py index a1be0fe514..f453592ebd 100644 --- a/heat/db/sqlalchemy/api.py +++ b/heat/db/sqlalchemy/api.py @@ -15,10 +15,10 @@ import datetime import itertools import random -import sys from oslo_config import cfg from oslo_db import api as oslo_db_api +from oslo_db import options from oslo_db.sqlalchemy import enginefacade from oslo_db.sqlalchemy import utils from oslo_log import log as logging @@ -50,6 +50,8 @@ CONF.import_opt('hidden_stack_tags', 'heat.common.config') CONF.import_opt('max_events_per_stack', 'heat.common.config') CONF.import_group('profiler', 'heat.common.config') +options.set_defaults(CONF) + _facade = None db_context = enginefacade.transaction_context() @@ -87,11 +89,6 @@ def get_session(): return get_facade().get_session() -def get_backend(): - """The backend is this module itself.""" - return sys.modules[__name__] - - def update_and_save(context, obj, values): with context.session.begin(subtransactions=True): for k, v in six.iteritems(values): diff --git a/heat/db/utils.py b/heat/db/utils.py deleted file mode 100644 index 23905502a2..0000000000 --- a/heat/db/utils.py +++ /dev/null @@ -1,57 +0,0 @@ -# -# 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. - - -class LazyPluggable(object): - """A pluggable backend loaded lazily based on some value.""" - - def __init__(self, pivot, **backends): - self.__backends = backends - self.__pivot = pivot - self.__backend = None - - def __get_backend(self): - if not self.__backend: - backend_name = 'sqlalchemy' - backend = self.__backends[backend_name] - if isinstance(backend, tuple): - name = backend[0] - fromlist = backend[1] - else: - name = backend - fromlist = backend - - self.__backend = __import__(name, None, None, fromlist) - return self.__backend - - def __getattr__(self, key): - backend = self.__get_backend() - return getattr(backend, key) - - -IMPL = LazyPluggable('backend', - sqlalchemy='heat.db.sqlalchemy.api') - - -def purge_deleted(age, granularity='days', project_id=None, batch_size=20): - IMPL.purge_deleted(age, granularity, project_id, batch_size) - - -def encrypt_parameters_and_properties(ctxt, encryption_key, verbose): - IMPL.db_encrypt_parameters_and_properties(ctxt, encryption_key, - verbose=verbose) - - -def decrypt_parameters_and_properties(ctxt, encryption_key, verbose): - IMPL.db_decrypt_parameters_and_properties(ctxt, encryption_key, - verbose=verbose) diff --git a/heat/engine/service_software_config.py b/heat/engine/service_software_config.py index ad48c9df02..7f433c7973 100644 --- a/heat/engine/service_software_config.py +++ b/heat/engine/service_software_config.py @@ -24,7 +24,7 @@ from heat.common import crypt from heat.common import exception from heat.common.i18n import _ from heat.common.i18n import _LI -from heat.db import api as db_api +from heat.db.sqlalchemy import api as db_api from heat.engine import api from heat.engine import scheduler from heat.engine import software_config_io as swc_io diff --git a/heat/engine/template_files.py b/heat/engine/template_files.py index 1d9f75fbb8..184c9d392a 100644 --- a/heat/engine/template_files.py +++ b/heat/engine/template_files.py @@ -17,7 +17,7 @@ import weakref from heat.common import context from heat.common.i18n import _ -from heat.db import api as db_api +from heat.db.sqlalchemy import api as db_api from heat.objects import raw_template_files _d = weakref.WeakValueDictionary() diff --git a/heat/engine/worker.py b/heat/engine/worker.py index 6b357f3627..a72fa73e69 100644 --- a/heat/engine/worker.py +++ b/heat/engine/worker.py @@ -25,7 +25,7 @@ from heat.common.i18n import _LE from heat.common.i18n import _LI from heat.common.i18n import _LW from heat.common import messaging as rpc_messaging -from heat.db import api as db_api +from heat.db.sqlalchemy import api as db_api from heat.engine import check_resource from heat.engine import stack as parser from heat.engine import sync_point diff --git a/heat/objects/event.py b/heat/objects/event.py index 10f8cd5cd4..7b1ef7bc28 100644 --- a/heat/objects/event.py +++ b/heat/objects/event.py @@ -18,7 +18,7 @@ from oslo_versionedobjects import base from oslo_versionedobjects import fields from heat.common import identifier -from heat.db import api as db_api +from heat.db.sqlalchemy import api as db_api from heat.objects import base as heat_base from heat.objects import fields as heat_fields diff --git a/heat/objects/raw_template.py b/heat/objects/raw_template.py index de1fb48211..06adc60b74 100644 --- a/heat/objects/raw_template.py +++ b/heat/objects/raw_template.py @@ -25,7 +25,7 @@ from oslo_versionedobjects import fields from heat.common import crypt from heat.common import environment_format as env_fmt from heat.common.i18n import _LW -from heat.db import api as db_api +from heat.db.sqlalchemy import api as db_api from heat.objects import base as heat_base from heat.objects import fields as heat_fields diff --git a/heat/objects/raw_template_files.py b/heat/objects/raw_template_files.py index 36d6cde91c..1afed6e7ed 100644 --- a/heat/objects/raw_template_files.py +++ b/heat/objects/raw_template_files.py @@ -16,7 +16,7 @@ from oslo_versionedobjects import base from oslo_versionedobjects import fields -from heat.db import api as db_api +from heat.db.sqlalchemy import api as db_api from heat.objects import base as heat_base from heat.objects import fields as heat_fields diff --git a/heat/objects/resource.py b/heat/objects/resource.py index d49efbd8a7..7530bc35c8 100644 --- a/heat/objects/resource.py +++ b/heat/objects/resource.py @@ -26,7 +26,7 @@ import tenacity from heat.common import crypt from heat.common import exception from heat.common.i18n import _ -from heat.db import api as db_api +from heat.db.sqlalchemy import api as db_api from heat.objects import base as heat_base from heat.objects import fields as heat_fields from heat.objects import resource_data diff --git a/heat/objects/resource_data.py b/heat/objects/resource_data.py index 7602bc0405..4b6419bcc6 100644 --- a/heat/objects/resource_data.py +++ b/heat/objects/resource_data.py @@ -19,7 +19,7 @@ from oslo_versionedobjects import base from oslo_versionedobjects import fields from heat.common import exception -from heat.db import api as db_api +from heat.db.sqlalchemy import api as db_api from heat.objects import base as heat_base diff --git a/heat/objects/service.py b/heat/objects/service.py index 5913a612cf..f5b1a92750 100644 --- a/heat/objects/service.py +++ b/heat/objects/service.py @@ -17,7 +17,7 @@ from oslo_versionedobjects import base from oslo_versionedobjects import fields -from heat.db import api as db_api +from heat.db.sqlalchemy import api as db_api from heat.objects import base as heat_base diff --git a/heat/objects/snapshot.py b/heat/objects/snapshot.py index 23d569a400..95c758d055 100644 --- a/heat/objects/snapshot.py +++ b/heat/objects/snapshot.py @@ -18,7 +18,7 @@ from oslo_versionedobjects import base from oslo_versionedobjects import fields -from heat.db import api as db_api +from heat.db.sqlalchemy import api as db_api from heat.objects import base as heat_base from heat.objects import fields as heat_fields diff --git a/heat/objects/software_config.py b/heat/objects/software_config.py index 0b7aac7d53..02ac8a9089 100644 --- a/heat/objects/software_config.py +++ b/heat/objects/software_config.py @@ -18,7 +18,7 @@ from oslo_versionedobjects import base from oslo_versionedobjects import fields -from heat.db import api as db_api +from heat.db.sqlalchemy import api as db_api from heat.objects import base as heat_base from heat.objects import fields as heat_fields diff --git a/heat/objects/software_deployment.py b/heat/objects/software_deployment.py index 564a48465b..2ff47ad93c 100644 --- a/heat/objects/software_deployment.py +++ b/heat/objects/software_deployment.py @@ -18,7 +18,7 @@ from oslo_versionedobjects import base from oslo_versionedobjects import fields -from heat.db import api as db_api +from heat.db.sqlalchemy import api as db_api from heat.objects import base as heat_base from heat.objects import fields as heat_fields from heat.objects import software_config diff --git a/heat/objects/stack.py b/heat/objects/stack.py index 1de7d5b118..cd52cbd2c4 100644 --- a/heat/objects/stack.py +++ b/heat/objects/stack.py @@ -22,7 +22,7 @@ import six from heat.common import exception from heat.common.i18n import _ from heat.common import identifier -from heat.db import api as db_api +from heat.db.sqlalchemy import api as db_api from heat.objects import base as heat_base from heat.objects import fields as heat_fields from heat.objects import raw_template diff --git a/heat/objects/stack_lock.py b/heat/objects/stack_lock.py index 21445b4239..1a00c40e9d 100644 --- a/heat/objects/stack_lock.py +++ b/heat/objects/stack_lock.py @@ -17,7 +17,7 @@ from oslo_versionedobjects import base from oslo_versionedobjects import fields -from heat.db import api as db_api +from heat.db.sqlalchemy import api as db_api from heat.objects import base as heat_base diff --git a/heat/objects/stack_tag.py b/heat/objects/stack_tag.py index 50d86deda7..3a75fffbfa 100644 --- a/heat/objects/stack_tag.py +++ b/heat/objects/stack_tag.py @@ -17,7 +17,7 @@ from oslo_versionedobjects import base from oslo_versionedobjects import fields -from heat.db import api as db_api +from heat.db.sqlalchemy import api as db_api from heat.objects import base as heat_base diff --git a/heat/objects/sync_point.py b/heat/objects/sync_point.py index 58dc3d58b2..264d323b8e 100644 --- a/heat/objects/sync_point.py +++ b/heat/objects/sync_point.py @@ -18,7 +18,7 @@ from oslo_versionedobjects import base from oslo_versionedobjects import fields -from heat.db import api as db_api +from heat.db.sqlalchemy import api as db_api from heat.objects import base as heat_base from heat.objects import fields as heat_fields diff --git a/heat/objects/user_creds.py b/heat/objects/user_creds.py index b41709bd9b..718e46c953 100644 --- a/heat/objects/user_creds.py +++ b/heat/objects/user_creds.py @@ -18,7 +18,7 @@ from oslo_versionedobjects import base from oslo_versionedobjects import fields -from heat.db import api as db_api +from heat.db.sqlalchemy import api as db_api from heat.objects import base as heat_base diff --git a/heat/objects/watch_data.py b/heat/objects/watch_data.py index 97f600b5d9..e972f337f7 100644 --- a/heat/objects/watch_data.py +++ b/heat/objects/watch_data.py @@ -17,7 +17,7 @@ from oslo_versionedobjects import base from oslo_versionedobjects import fields -from heat.db import api as db_api +from heat.db.sqlalchemy import api as db_api from heat.objects import base as heat_base from heat.objects import fields as heat_fields diff --git a/heat/objects/watch_rule.py b/heat/objects/watch_rule.py index cec487b355..36ff0c27d0 100644 --- a/heat/objects/watch_rule.py +++ b/heat/objects/watch_rule.py @@ -17,7 +17,7 @@ from oslo_versionedobjects import base from oslo_versionedobjects import fields -from heat.db import api as db_api +from heat.db.sqlalchemy import api as db_api from heat.objects import base as heat_base from heat.objects import fields as heat_fields from heat.objects import watch_data diff --git a/heat/tests/convergence/framework/engine_wrapper.py b/heat/tests/convergence/framework/engine_wrapper.py index 9013b07c6f..ed60ca1983 100644 --- a/heat/tests/convergence/framework/engine_wrapper.py +++ b/heat/tests/convergence/framework/engine_wrapper.py @@ -13,7 +13,7 @@ import six -from heat.db import api as db_api +from heat.db.sqlalchemy import api as db_api from heat.engine import service from heat.engine import stack from heat.tests.convergence.framework import message_processor diff --git a/heat/tests/convergence/framework/reality.py b/heat/tests/convergence/framework/reality.py index 5e8ab956e3..4951541dc4 100644 --- a/heat/tests/convergence/framework/reality.py +++ b/heat/tests/convergence/framework/reality.py @@ -12,7 +12,7 @@ # under the License. from heat.common import exception -from heat.db import api as db_api +from heat.db.sqlalchemy import api as db_api from heat.tests import utils diff --git a/heat/tests/engine/service/test_software_config.py b/heat/tests/engine/service/test_software_config.py index eb6c717a0c..17328d44dc 100644 --- a/heat/tests/engine/service/test_software_config.py +++ b/heat/tests/engine/service/test_software_config.py @@ -23,7 +23,7 @@ import six from heat.common import crypt from heat.common import exception from heat.common import template_format -from heat.db import api as db_api +from heat.db.sqlalchemy import api as db_api from heat.engine.clients.os import swift from heat.engine.clients.os import zaqar from heat.engine import service diff --git a/heat/tests/engine/service/test_stack_update.py b/heat/tests/engine/service/test_stack_update.py index fde8df368f..6ef3e4499d 100644 --- a/heat/tests/engine/service/test_stack_update.py +++ b/heat/tests/engine/service/test_stack_update.py @@ -23,7 +23,7 @@ from heat.common import exception from heat.common import messaging from heat.common import service_utils from heat.common import template_format -from heat.db import api as db_api +from heat.db.sqlalchemy import api as db_api from heat.engine.clients.os import glance from heat.engine.clients.os import nova from heat.engine import environment diff --git a/heat/tests/engine/test_engine_worker.py b/heat/tests/engine/test_engine_worker.py index 3ade9eddad..93781179de 100644 --- a/heat/tests/engine/test_engine_worker.py +++ b/heat/tests/engine/test_engine_worker.py @@ -15,7 +15,7 @@ import mock -from heat.db import api as db_api +from heat.db.sqlalchemy import api as db_api from heat.engine import check_resource from heat.engine import stack as parser from heat.engine import template as templatem diff --git a/heat/tests/test_resource.py b/heat/tests/test_resource.py index 7c8a284340..7f1eb685cc 100644 --- a/heat/tests/test_resource.py +++ b/heat/tests/test_resource.py @@ -27,7 +27,7 @@ from heat.common import exception from heat.common.i18n import _ from heat.common import short_id from heat.common import timeutils -from heat.db import api as db_api +from heat.db.sqlalchemy import api as db_api from heat.engine import attributes from heat.engine.cfn import functions as cfn_funcs from heat.engine import clients diff --git a/heat/tests/test_stack.py b/heat/tests/test_stack.py index b3e72ea789..8dcbc3e625 100644 --- a/heat/tests/test_stack.py +++ b/heat/tests/test_stack.py @@ -29,7 +29,7 @@ from heat.common import context from heat.common import exception from heat.common import template_format from heat.common import timeutils -from heat.db import api as db_api +from heat.db.sqlalchemy import api as db_api from heat.engine.clients.os import keystone from heat.engine.clients.os import nova from heat.engine import environment diff --git a/heat/tests/utils.py b/heat/tests/utils.py index ec1d0831b9..6fbaba7260 100644 --- a/heat/tests/utils.py +++ b/heat/tests/utils.py @@ -22,7 +22,7 @@ from oslo_serialization import jsonutils import sqlalchemy from heat.common import context -from heat.db import api as db_api +from heat.db.sqlalchemy import api as db_api from heat.db.sqlalchemy import models from heat.engine import environment from heat.engine import resource