diff --git a/oslo/db/sqlalchemy/provision.py b/oslo/db/sqlalchemy/provision.py index 598305b6..317d7f90 100644 --- a/oslo/db/sqlalchemy/provision.py +++ b/oslo/db/sqlalchemy/provision.py @@ -52,7 +52,7 @@ def _execute_sql(engine, sql, driver): except sqlalchemy.exc.OperationalError: msg = ('%s does not match database admin ' 'credentials or database does not exist.') - LOG.exception(msg % engine.url) + LOG.exception(msg, engine.url) raise exc.DBConnectionError(msg % engine.url) diff --git a/oslo/db/sqlalchemy/session.py b/oslo/db/sqlalchemy/session.py index 9bf4b6d2..e7236c87 100644 --- a/oslo/db/sqlalchemy/session.py +++ b/oslo/db/sqlalchemy/session.py @@ -671,7 +671,7 @@ def create_engine(sql_connection, sqlite_fk=False, mysql_sql_mode=None, remaining = 'infinite' while True: msg = _LW('SQL connection failed. %s attempts left.') - LOG.warning(msg % remaining) + LOG.warning(msg, remaining) if remaining != 'infinite': remaining -= 1 time.sleep(retry_interval) diff --git a/oslo/db/sqlalchemy/test_migrations.py b/oslo/db/sqlalchemy/test_migrations.py index 661b0a7e..5972d03a 100644 --- a/oslo/db/sqlalchemy/test_migrations.py +++ b/oslo/db/sqlalchemy/test_migrations.py @@ -60,10 +60,10 @@ def _set_db_lock(lock_path=None, lock_prefix=None): path = lock_path or os.environ.get("OSLO_LOCK_PATH") lock = lockfile.FileLock(os.path.join(path, lock_prefix)) with lock: - LOG.debug('Got lock "%s"' % f.__name__) + LOG.debug('Got lock "%s"', f.__name__) return f(*args, **kwargs) finally: - LOG.debug('Lock released "%s"' % f.__name__) + LOG.debug('Lock released "%s"', f.__name__) return wrapper return decorator @@ -88,7 +88,7 @@ class BaseMigrationTestCase(test_base.BaseTestCase): # Load test databases from the config file. Only do this # once. No need to re-run this on each test... - LOG.debug('config_path is %s' % self.CONFIG_FILE_PATH) + LOG.debug('config_path is %s', self.CONFIG_FILE_PATH) if os.path.exists(self.CONFIG_FILE_PATH): cp = moves.configparser.RawConfigParser() try: @@ -193,7 +193,7 @@ class WalkVersionsMixin(object): self.migration_api.db_version(engine, self.REPOSITORY)) - LOG.debug('latest version is %s' % self.REPOSITORY.latest) + LOG.debug('latest version is %s', self.REPOSITORY.latest) versions = range(self.INIT_VERSION + 1, self.REPOSITORY.latest + 1) for version in versions: @@ -264,6 +264,7 @@ class WalkVersionsMixin(object): if check: check(engine, data) except Exception: - LOG.error(_LE("Failed to migrate to version %s on engine %s") % - (version, engine)) + LOG.error(_LE("Failed to migrate to version %(version)s on " + "engine %(engine)s"), {'version': version, + 'engine': engine}) raise diff --git a/oslo/db/sqlalchemy/utils.py b/oslo/db/sqlalchemy/utils.py index 4e17fc7e..12ffcd9c 100644 --- a/oslo/db/sqlalchemy/utils.py +++ b/oslo/db/sqlalchemy/utils.py @@ -385,7 +385,7 @@ def drop_old_duplicate_entries_from_table(migrate_engine, table_name, [table.c.id]).where(delete_condition) for row in migrate_engine.execute(rows_to_delete_select).fetchall(): LOG.info(_LI("Deleting duplicated row with id: %(id)s from table: " - "%(table)s") % dict(id=row[0], table=table_name)) + "%(table)s"), dict(id=row[0], table=table_name)) if use_soft_delete: delete_statement = table.update().\