Merge "db: Remove layer of indirection"

This commit is contained in:
Zuul 2023-04-07 17:46:50 +00:00 committed by Gerrit Code Review
commit cec8eb12c6
50 changed files with 68 additions and 73 deletions

View File

@ -25,8 +25,8 @@ from heat.common import exception
from heat.common.i18n import _
from heat.common import messaging
from heat.common import service_utils
from heat.db.sqlalchemy import api as db_api
from heat.db.sqlalchemy import migration as db_migration
from heat.db import api as db_api
from heat.db import migration as db_migration
from heat.objects import service as service_objects
from heat.rpc import client as rpc_client
from heat import version

View File

@ -31,12 +31,11 @@ from heat.common import endpoint_utils
from heat.common import exception
from heat.common import policy
from heat.common import wsgi
from heat.db.sqlalchemy import api as db_api
from heat.db import api as db_api
from heat.engine import clients
LOG = logging.getLogger(__name__)
cfg.CONF.import_opt('client_retry_limit', 'heat.common.config')
# Note, we yield the options via list_opts to enable generation of the

View File

@ -7,10 +7,10 @@ script_location = %(here)s/migrations
prepend_sys_path = .
# version location specification; This defaults
# to heat/db/sqlalchemy/migrations/versions. When using multiple version
# to heat/db/migrations/versions. When using multiple version
# directories, initial revisions must be specified with --version-path.
# The path separator used here should be the separator specified by "version_path_separator" below.
# version_locations = %(here)s/bar:%(here)s/bat:heat/db/sqlalchemy/migrations/versions
# version_locations = %(here)s/bar:%(here)s/bat:heat/db/migrations/versions
# version path separator; As mentioned above, this is the character used to split
# version_locations. The default within new alembic.ini files is "os", which uses os.pathsep.

View File

@ -38,9 +38,9 @@ from sqlalchemy.orm import aliased as orm_aliased
from heat.common import crypt
from heat.common import exception
from heat.common.i18n import _
from heat.db.sqlalchemy import filters as db_filters
from heat.db.sqlalchemy import models
from heat.db.sqlalchemy import utils as db_utils
from heat.db import filters as db_filters
from heat.db import models
from heat.db import utils as db_utils
from heat.engine import environment as heat_environment
from heat.rpc import api as rpc_api

View File

@ -18,7 +18,7 @@ from alembic import migration as alembic_migration
from oslo_log import log as logging
import sqlalchemy as sa
from heat.db.sqlalchemy import api as db_api
from heat.db import api as db_api
LOG = logging.getLogger(__name__)

View File

@ -16,7 +16,7 @@ from alembic import context
from sqlalchemy import engine_from_config
from sqlalchemy import pool
from heat.db.sqlalchemy import models
from heat.db import models
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.

View File

@ -20,7 +20,7 @@ Create Date: 2023-03-22 18:04:02.387269
from alembic import op
import sqlalchemy as sa
import heat.db.sqlalchemy.types
import heat.db.types
# revision identifiers, used by Alembic.
revision = 'c6214ca60943'
@ -33,7 +33,7 @@ def upgrade() -> None:
op.create_table(
'raw_template_files',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('files', heat.db.sqlalchemy.types.Json(), nullable=True),
sa.Column('files', heat.db.types.Json(), nullable=True),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('updated_at', sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint('id'),
@ -42,7 +42,7 @@ def upgrade() -> None:
op.create_table(
'resource_properties_data',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('data', heat.db.sqlalchemy.types.Json(), nullable=True),
sa.Column('data', heat.db.types.Json(), nullable=True),
sa.Column('encrypted', sa.Boolean(), nullable=True),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('updated_at', sa.DateTime(), nullable=True),
@ -71,7 +71,7 @@ def upgrade() -> None:
sa.Column('updated_at', sa.DateTime(), nullable=True),
sa.Column('name', sa.String(length=255), nullable=True),
sa.Column('group', sa.String(length=255), nullable=True),
sa.Column('config', heat.db.sqlalchemy.types.Json(), nullable=True),
sa.Column('config', heat.db.types.Json(), nullable=True),
sa.Column('tenant', sa.String(length=64), nullable=False),
sa.PrimaryKeyConstraint('id'),
mysql_engine='InnoDB',
@ -104,10 +104,10 @@ def upgrade() -> None:
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('updated_at', sa.DateTime(), nullable=True),
sa.Column('template', heat.db.sqlalchemy.types.Json(), nullable=True),
sa.Column('files', heat.db.sqlalchemy.types.Json(), nullable=True),
sa.Column('template', heat.db.types.Json(), nullable=True),
sa.Column('files', heat.db.types.Json(), nullable=True),
sa.Column(
'environment', heat.db.sqlalchemy.types.Json(), nullable=True
'environment', heat.db.types.Json(), nullable=True
),
sa.Column('files_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(
@ -126,10 +126,10 @@ def upgrade() -> None:
sa.Column('server_id', sa.String(length=36), nullable=False),
sa.Column('config_id', sa.String(length=36), nullable=False),
sa.Column(
'input_values', heat.db.sqlalchemy.types.Json(), nullable=True
'input_values', heat.db.types.Json(), nullable=True
),
sa.Column(
'output_values', heat.db.sqlalchemy.types.Json(), nullable=True
'output_values', heat.db.types.Json(), nullable=True
),
sa.Column('action', sa.String(length=255), nullable=True),
sa.Column('status', sa.String(length=255), nullable=True),
@ -188,7 +188,7 @@ def upgrade() -> None:
sa.Column('convergence', sa.Boolean(), nullable=True),
sa.Column('current_traversal', sa.String(length=36), nullable=True),
sa.Column(
'current_deps', heat.db.sqlalchemy.types.Json(), nullable=True
'current_deps', heat.db.types.Json(), nullable=True
),
sa.Column(
'parent_resource_name', sa.String(length=255), nullable=True
@ -261,15 +261,15 @@ def upgrade() -> None:
sa.Column('status_reason', sa.Text(), nullable=True),
sa.Column('stack_id', sa.String(length=36), nullable=False),
sa.Column(
'rsrc_metadata', heat.db.sqlalchemy.types.Json(), nullable=True
'rsrc_metadata', heat.db.types.Json(), nullable=True
),
sa.Column(
'properties_data', heat.db.sqlalchemy.types.Json(), nullable=True
'properties_data', heat.db.types.Json(), nullable=True
),
sa.Column('engine_id', sa.String(length=36), nullable=True),
sa.Column('atomic_key', sa.Integer(), nullable=True),
sa.Column('needed_by', heat.db.sqlalchemy.types.List(), nullable=True),
sa.Column('requires', heat.db.sqlalchemy.types.List(), nullable=True),
sa.Column('needed_by', heat.db.types.List(), nullable=True),
sa.Column('requires', heat.db.types.List(), nullable=True),
sa.Column('replaces', sa.Integer(), nullable=True),
sa.Column('replaced_by', sa.Integer(), nullable=True),
sa.Column('current_template_id', sa.Integer(), nullable=True),
@ -314,7 +314,7 @@ def upgrade() -> None:
sa.Column('updated_at', sa.DateTime(), nullable=True),
sa.Column('status', sa.String(length=255), nullable=True),
sa.Column('status_reason', sa.String(length=255), nullable=True),
sa.Column('data', heat.db.sqlalchemy.types.Json(), nullable=True),
sa.Column('data', heat.db.types.Json(), nullable=True),
sa.Column('tenant', sa.String(length=64), nullable=False),
sa.ForeignKeyConstraint(
['stack_id'],
@ -361,7 +361,7 @@ def upgrade() -> None:
sa.Column('atomic_key', sa.Integer(), nullable=False),
sa.Column('stack_id', sa.String(length=36), nullable=False),
sa.Column(
'input_data', heat.db.sqlalchemy.types.Json(), nullable=True
'input_data', heat.db.types.Json(), nullable=True
),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('updated_at', sa.DateTime(), nullable=True),

View File

@ -21,7 +21,7 @@ from sqlalchemy.ext import declarative
from sqlalchemy.orm import backref
from sqlalchemy.orm import relationship
from heat.db.sqlalchemy import types
from heat.db import types
BASE = declarative.declarative_base()

View File

@ -23,7 +23,7 @@ from urllib import parse
from heat.common import crypt
from heat.common import exception
from heat.common.i18n import _
from heat.db.sqlalchemy import api as db_api
from heat.db import api as db_api
from heat.engine import api
from heat.engine import resource
from heat.engine import scheduler

View File

@ -17,7 +17,7 @@ import weakref
from heat.common import context
from heat.common import exception
from heat.common.i18n import _
from heat.db.sqlalchemy import api as db_api
from heat.db import api as db_api
from heat.objects import raw_template_files
_d = weakref.WeakValueDictionary()

View File

@ -24,7 +24,7 @@ from osprofiler import profiler
from heat.common import context
from heat.common import messaging as rpc_messaging
from heat.db.sqlalchemy import api as db_api
from heat.db import api as db_api
from heat.engine import check_resource
from heat.engine import node_data
from heat.engine import stack as parser

View File

@ -19,7 +19,7 @@ from oslo_versionedobjects import base
from oslo_versionedobjects import fields
from heat.common import identifier
from heat.db.sqlalchemy import api as db_api
from heat.db import api as db_api
from heat.objects import base as heat_base
from heat.objects import resource_properties_data as rpd

View File

@ -24,7 +24,7 @@ from oslo_versionedobjects import fields
from heat.common import crypt
from heat.common import environment_format as env_fmt
from heat.db.sqlalchemy import api as db_api
from heat.db import api as db_api
from heat.objects import base as heat_base
from heat.objects import fields as heat_fields

View File

@ -16,7 +16,7 @@
from oslo_versionedobjects import base
from oslo_versionedobjects import fields
from heat.db.sqlalchemy import api as db_api
from heat.db import api as db_api
from heat.objects import base as heat_base
from heat.objects import fields as heat_fields

View File

@ -26,7 +26,7 @@ import tenacity
from heat.common import crypt
from heat.common import exception
from heat.common.i18n import _
from heat.db.sqlalchemy import api as db_api
from heat.db 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

View File

@ -19,7 +19,7 @@ from oslo_versionedobjects import base
from oslo_versionedobjects import fields
from heat.common import exception
from heat.db.sqlalchemy import api as db_api
from heat.db import api as db_api
from heat.objects import base as heat_base

View File

@ -19,7 +19,7 @@ from oslo_versionedobjects import base
from oslo_versionedobjects import fields
from heat.common import crypt
from heat.db.sqlalchemy import api as db_api
from heat.db import api as db_api
from heat.objects import fields as heat_fields

View File

@ -18,7 +18,7 @@ from oslo_versionedobjects import base
from oslo_versionedobjects import fields
from heat.common import service_utils
from heat.db.sqlalchemy import api as db_api
from heat.db import api as db_api
from heat.objects import base as heat_base

View File

@ -18,7 +18,7 @@
from oslo_versionedobjects import base
from oslo_versionedobjects import fields
from heat.db.sqlalchemy import api as db_api
from heat.db import api as db_api
from heat.objects import base as heat_base
from heat.objects import fields as heat_fields

View File

@ -12,13 +12,12 @@
# License for the specific language governing permissions and limitations
# under the License.
"""SoftwareConfig object."""
from oslo_versionedobjects import base
from oslo_versionedobjects import fields
from heat.db.sqlalchemy import api as db_api
from heat.db import api as db_api
from heat.objects import base as heat_base
from heat.objects import fields as heat_fields

View File

@ -18,7 +18,7 @@
from oslo_versionedobjects import base
from oslo_versionedobjects import fields
from heat.db.sqlalchemy import api as db_api
from heat.db 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

View File

@ -22,7 +22,7 @@ from oslo_versionedobjects import fields
from heat.common import exception
from heat.common.i18n import _
from heat.common import identifier
from heat.db.sqlalchemy import api as db_api
from heat.db 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

View File

@ -11,13 +11,12 @@
# License for the specific language governing permissions and limitations
# under the License.
"""StackLock object."""
from oslo_versionedobjects import base
from oslo_versionedobjects import fields
from heat.db.sqlalchemy import api as db_api
from heat.db import api as db_api
from heat.objects import base as heat_base

View File

@ -17,7 +17,7 @@
from oslo_versionedobjects import base
from oslo_versionedobjects import fields
from heat.db.sqlalchemy import api as db_api
from heat.db import api as db_api
from heat.objects import base as heat_base

View File

@ -11,14 +11,12 @@
# License for the specific language governing permissions and limitations
# under the License.
"""SyncPoint object."""
from oslo_versionedobjects import base
from oslo_versionedobjects import fields
from heat.db.sqlalchemy import api as db_api
from heat.db import api as db_api
from heat.objects import base as heat_base
from heat.objects import fields as heat_fields

View File

@ -18,7 +18,7 @@
from oslo_versionedobjects import base
from oslo_versionedobjects import fields
from heat.db.sqlalchemy import api as db_api
from heat.db import api as db_api
from heat.objects import base as heat_base

View File

@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from heat.db.sqlalchemy import api as db_api
from heat.db import api as db_api
from heat.engine import service
from heat.engine import stack
from heat.tests.convergence.framework import message_processor

View File

@ -14,7 +14,7 @@
from unittest import mock
from heat.common import exception
from heat.db.sqlalchemy import api as db_api
from heat.db import api as db_api
from heat.tests import utils

View File

@ -22,8 +22,8 @@ from oslotest import base as test_base
import sqlalchemy
import testtools
from heat.db.sqlalchemy import migration
from heat.db.sqlalchemy import models
from heat.db import migration
from heat.db import models
class DBNotAllowed(Exception):

View File

@ -30,8 +30,8 @@ from heat.common import context
from heat.common import exception
from heat.common import short_id
from heat.common import template_format
from heat.db.sqlalchemy import api as db_api
from heat.db.sqlalchemy import models
from heat.db import api as db_api
from heat.db import models
from heat.engine.clients.os import glance
from heat.engine.clients.os import nova
from heat.engine import environment
@ -2308,7 +2308,7 @@ class DBAPIStackTest(common.HeatTestCase):
create_stack(self.ctx, self.template, self.user_creds,
deleted_at=deleted)
with mock.patch('heat.db.sqlalchemy.api._purge_stacks') as mock_ps:
with mock.patch('heat.db.api._purge_stacks') as mock_ps:
db_api.purge_deleted(age=0, batch_size=2)
self.assertEqual(4, mock_ps.call_count)

View File

@ -13,7 +13,7 @@
from unittest import mock
from heat.db.sqlalchemy import filters as db_filters
from heat.db import filters as db_filters
from heat.tests import common

View File

@ -15,7 +15,7 @@ from sqlalchemy.dialects.mysql import base as mysql_base
from sqlalchemy.dialects.sqlite import base as sqlite_base
from sqlalchemy import types
from heat.db.sqlalchemy import types as db_types
from heat.db import types as db_types
from heat.tests import common

View File

@ -22,7 +22,7 @@ from oslo_utils import timeutils
from heat.common import crypt
from heat.common import exception
from heat.common import template_format
from heat.db.sqlalchemy import api as db_api
from heat.db import api as db_api
from heat.engine.clients.os import swift
from heat.engine.clients.os import zaqar
from heat.engine import service

View File

@ -24,7 +24,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.sqlalchemy import api as db_api
from heat.db import api as db_api
from heat.engine.clients.os import glance
from heat.engine.clients.os import nova
from heat.engine.clients.os import swift

View File

@ -15,7 +15,7 @@
from unittest import mock
from heat.db.sqlalchemy import api as db_api
from heat.db 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

View File

@ -18,7 +18,7 @@ from oslo_utils import timeutils
import uuid
from heat.common import service_utils
from heat.db.sqlalchemy import models
from heat.db import models
from heat.tests import common

View File

@ -21,7 +21,7 @@ from oslo_utils import timeutils
from heat.common import exception
from heat.common import template_format
from heat.common import timeutils as heat_timeutils
from heat.db.sqlalchemy import models
from heat.db import models
from heat.engine import api
from heat.engine.cfn import parameters as cfn_param
from heat.engine import event

View File

@ -16,7 +16,7 @@ from unittest import mock
from oslo_config import cfg
import uuid
from heat.db.sqlalchemy import models
from heat.db import models
from heat.engine import event
from heat.engine import stack
from heat.engine import template

View File

@ -27,8 +27,8 @@ from heat.common import exception
from heat.common.i18n import _
from heat.common import short_id
from heat.common import timeutils
from heat.db.sqlalchemy import api as db_api
from heat.db.sqlalchemy import models
from heat.db import api as db_api
from heat.db import models
from heat.engine import attributes
from heat.engine.cfn import functions as cfn_funcs
from heat.engine import clients

View File

@ -13,7 +13,7 @@
from oslo_config import cfg
from heat.db.sqlalchemy import models
from heat.db import models
from heat.objects import resource_properties_data as rpd_object
from heat.tests import common
from heat.tests import utils

View File

@ -20,7 +20,7 @@ from oslo_utils import timeutils
from heat.common import exception
from heat.common import template_format
from heat.db.sqlalchemy import models
from heat.db import models
from heat.engine.clients.os import heat_plugin
from heat.engine.clients.os.keystone import fake_keystoneclient as fake_ks
from heat.engine.clients.os import swift

View File

@ -27,7 +27,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.sqlalchemy import api as db_api
from heat.db import api as db_api
from heat.engine.clients.os import keystone
from heat.engine.clients.os.keystone import fake_keystoneclient as fake_ks
from heat.engine.clients.os import nova

View File

@ -17,7 +17,7 @@ from unittest import mock
from heat.common import exception
from heat.common import template_format
from heat.db.sqlalchemy import api as db_api
from heat.db import api as db_api
from heat.engine.clients.os.keystone import fake_keystoneclient
from heat.engine import environment
from heat.engine import resource

View File

@ -24,8 +24,8 @@ import sqlalchemy
from sqlalchemy import exc as sqla_exc
from heat.common import context
from heat.db.sqlalchemy import api as db_api
from heat.db.sqlalchemy import models
from heat.db import api as db_api
from heat.db import models
from heat.engine import environment
from heat.engine import node_data
from heat.engine import resource