db: Disable logging by default for alembic
We don't want alembic overriding our logging: we can configure it ourselves. This removes a whole lot of noise from our test output. Change-Id: Ic1bc4ab967913a8adaac559482d330d72e47a4b5 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
This commit is contained in:
parent
1f5bbf0bd1
commit
9b9afcaa29
|
@ -27,6 +27,10 @@ def get_alembic_config(engine=None):
|
|||
"""Return a valid alembic config object"""
|
||||
ini_path = os.path.join(os.path.dirname(__file__), 'alembic.ini')
|
||||
config = alembic_config.Config(os.path.abspath(ini_path))
|
||||
# we don't want to use the logger configuration from the file, which is
|
||||
# only really intended for the CLI
|
||||
# https://stackoverflow.com/a/42691781/613428
|
||||
config.attributes['configure_logger'] = False
|
||||
if engine is None:
|
||||
engine = db_api.get_engine()
|
||||
# str(sqlalchemy.engine.url.URL) returns a RFC-1738 quoted URL.
|
||||
|
@ -61,9 +65,9 @@ def get_current_alembic_heads():
|
|||
version_num=new).where(
|
||||
alembic_version.c.version_num == old).execute()
|
||||
|
||||
if ("pike01" in heads):
|
||||
if "pike01" in heads:
|
||||
update_alembic_version("pike01", "pike_contract01")
|
||||
elif ("ocata01" in heads):
|
||||
elif "ocata01" in heads:
|
||||
update_alembic_version("ocata01", "ocata_contract01")
|
||||
|
||||
heads = context.get_current_heads()
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
# 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 logging import config as log_config
|
||||
|
||||
from alembic import context
|
||||
|
@ -26,17 +27,12 @@ from glance.db.sqlalchemy import models_metadef
|
|||
config = context.config
|
||||
CONF = cfg.CONF
|
||||
|
||||
# other values from the config, defined by the needs of env.py,
|
||||
# can be acquired:
|
||||
# my_important_option = config.get_main_option("my_important_option")
|
||||
# ... etc.
|
||||
|
||||
# Interpret the config file for Python logging.
|
||||
# Interpret the config file for Python logging unless we're told not to.
|
||||
# This line sets up loggers basically.
|
||||
log_config.fileConfig(config.config_file_name)
|
||||
if config.attributes.get('configure_logger', True):
|
||||
log_config.fileConfig(config.config_file_name)
|
||||
|
||||
# add your model's MetaData object here
|
||||
# for 'autogenerate' support
|
||||
# this is the MetaData object for the various models in the database
|
||||
target_metadata = models.BASE.metadata
|
||||
for table in models_metadef.BASE_DICT.metadata.sorted_tables:
|
||||
target_metadata._add_table(table.name, table.schema, table)
|
||||
|
|
Loading…
Reference in New Issue