Browse Source

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
changes/34/94334/3
Christian Berendt 8 years ago
parent
commit
d09fff6640
  1. 2
      oslo/db/sqlalchemy/provision.py
  2. 2
      oslo/db/sqlalchemy/session.py
  3. 13
      oslo/db/sqlalchemy/test_migrations.py
  4. 2
      oslo/db/sqlalchemy/utils.py

2
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)

2
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)

13
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

2
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().\

Loading…
Cancel
Save