summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Berendt <berendt@b1-systems.de>2014-05-20 11:58:58 +0200
committerChristian Berendt <berendt@b1-systems.de>2014-06-04 08:20:44 +0000
commitd09fff66407a8f24ef724cafb69b04311ec11f7d (patch)
treef34948782e7a9e22b13538391e3c241818902ba1
parent82bbac9d649aa7762f380ee1a76b3164d9d2fffa (diff)
downloadoslo-db-d09fff66407a8f24ef724cafb69b04311ec11f7d.tar.gz
replace string format arguments with function parameters
There are files containing string format arguments inside logging messages. Using logging function parameters should be preferred. Change-Id: I089a4c51c0fe98906d74bcdbd5394e74631d0dba Partial-Bug: #1321274
-rw-r--r--oslo/db/sqlalchemy/provision.py2
-rw-r--r--oslo/db/sqlalchemy/session.py2
-rw-r--r--oslo/db/sqlalchemy/test_migrations.py13
-rw-r--r--oslo/db/sqlalchemy/utils.py2
4 files changed, 10 insertions, 9 deletions
diff --git a/oslo/db/sqlalchemy/provision.py b/oslo/db/sqlalchemy/provision.py
index 598305b..317d7f9 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 9bf4b6d..e7236c8 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 661b0a7..5972d03 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 4e17fc7..12ffcd9 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().\