fix all the log statments to use %s fomatting
Closes-Bug: 1358500 Change-Id: I010d7a7b47855cd1d5e984d5cda04ec075fe264c
This commit is contained in:
@@ -78,7 +78,7 @@ class ContainerConsumersController(object):
|
||||
@controllers.enforce_rbac('consumers:get')
|
||||
def index(self, keystone_id, **kw):
|
||||
LOG.debug('Start consumers on_get '
|
||||
'for container-ID {0}:'.format(self.container_id))
|
||||
'for container-ID %s:', self.container_id)
|
||||
|
||||
try:
|
||||
self.container_repo.get(self.container_id, keystone_id)
|
||||
@@ -120,7 +120,7 @@ class ContainerConsumersController(object):
|
||||
|
||||
tenant = res.get_or_create_tenant(keystone_id, self.tenant_repo)
|
||||
data = api.load_body(pecan.request, validator=self.validator)
|
||||
LOG.debug('Start on_post...{0}'.format(data))
|
||||
LOG.debug('Start on_post...%s', data)
|
||||
|
||||
try:
|
||||
self.container_repo.get(self.container_id, keystone_id)
|
||||
@@ -152,7 +152,7 @@ class ContainerConsumersController(object):
|
||||
)
|
||||
if not consumer:
|
||||
_consumer_not_found()
|
||||
LOG.debug("Found consumer: {0}".format(consumer))
|
||||
LOG.debug("Found consumer: %s", consumer)
|
||||
|
||||
try:
|
||||
self.consumer_repo.delete_entity_by_id(consumer.id, keystone_id)
|
||||
|
||||
@@ -103,7 +103,7 @@ class ContainersController(object):
|
||||
@controllers.enforce_rbac('containers:get')
|
||||
def index(self, keystone_id, **kw):
|
||||
LOG.debug('Start containers on_get '
|
||||
'for tenant-ID {0}:'.format(keystone_id))
|
||||
'for tenant-ID %s:', keystone_id)
|
||||
|
||||
result = self.container_repo.get_by_create_date(
|
||||
keystone_id,
|
||||
@@ -141,7 +141,7 @@ class ContainersController(object):
|
||||
tenant = res.get_or_create_tenant(keystone_id, self.tenant_repo)
|
||||
|
||||
data = api.load_body(pecan.request, validator=self.validator)
|
||||
LOG.debug('Start on_post...{0}'.format(data))
|
||||
LOG.debug('Start on_post...%s', data)
|
||||
|
||||
new_container = models.Container(data)
|
||||
new_container.tenant_id = tenant.id
|
||||
|
||||
@@ -103,7 +103,7 @@ class OrdersController(object):
|
||||
@controllers.enforce_rbac('orders:get')
|
||||
def index(self, keystone_id, **kw):
|
||||
LOG.debug('Start orders on_get '
|
||||
'for tenant-ID {0}:'.format(keystone_id))
|
||||
'for tenant-ID %s:', keystone_id)
|
||||
|
||||
result = self.order_repo \
|
||||
.get_by_create_date(keystone_id,
|
||||
@@ -151,9 +151,9 @@ class OrdersController(object):
|
||||
if order_type:
|
||||
body = api.load_body(pecan.request,
|
||||
validator=self.type_order_validator)
|
||||
LOG.debug('Start on_post...{0}'.format(body))
|
||||
LOG.debug('Start on_post...%s', body)
|
||||
name = body.get('meta').get('name')
|
||||
LOG.debug('Order to create is {0}'.format(name))
|
||||
LOG.debug('Order to create is %s', name)
|
||||
new_order = models.Order(body)
|
||||
#TODO(atiwari): we need to make another round of model
|
||||
# change to address. payload_content_type can not be None
|
||||
@@ -162,13 +162,13 @@ class OrdersController(object):
|
||||
'payload_content_type')
|
||||
else:
|
||||
body = api.load_body(pecan.request, validator=self.validator)
|
||||
LOG.debug('Start on_post...{0}'.format(body))
|
||||
LOG.debug('Start on_post...%s', body)
|
||||
|
||||
if 'secret' not in body:
|
||||
_secret_not_in_order()
|
||||
secret_info = body['secret']
|
||||
name = secret_info.get('name')
|
||||
LOG.debug('Secret to create is {0}'.format(name))
|
||||
LOG.debug('Secret to create is %s', name)
|
||||
|
||||
new_order = models.Order()
|
||||
new_order.secret_name = secret_info.get('name')
|
||||
|
||||
@@ -216,7 +216,7 @@ class SecretsController(object):
|
||||
@controllers.enforce_rbac('secrets:get')
|
||||
def index(self, keystone_id, **kw):
|
||||
LOG.debug('Start secrets on_get '
|
||||
'for tenant-ID {0}:'.format(keystone_id))
|
||||
'for tenant-ID %s:', keystone_id)
|
||||
|
||||
name = kw.get('name', '')
|
||||
if name:
|
||||
@@ -266,7 +266,7 @@ class SecretsController(object):
|
||||
@controllers.enforce_rbac('secrets:post')
|
||||
@controllers.enforce_content_types(['application/json'])
|
||||
def on_post(self, keystone_id, **kwargs):
|
||||
LOG.debug('Start on_post for tenant-ID {0}:...'.format(keystone_id))
|
||||
LOG.debug('Start on_post for tenant-ID %s:...', keystone_id)
|
||||
|
||||
data = api.load_body(pecan.request, validator=self.validator)
|
||||
tenant = res.get_or_create_tenant(keystone_id, self.repos.tenant_repo)
|
||||
@@ -289,7 +289,7 @@ class SecretsController(object):
|
||||
new_secret.id
|
||||
)
|
||||
url = hrefs.convert_secret_to_href(new_secret.id)
|
||||
LOG.debug('URI to secret is {0}'.format(url))
|
||||
LOG.debug('URI to secret is %s', url)
|
||||
if transport_key_model is not None:
|
||||
tkey_url = hrefs.convert_transport_key_to_href(
|
||||
transport_key_model.id)
|
||||
|
||||
@@ -46,7 +46,7 @@ class TransportKeyController(object):
|
||||
@controllers.handle_exceptions(u._('Transport Key retrieval'))
|
||||
@controllers.enforce_rbac('transport_key:get')
|
||||
def index(self, keystone_id):
|
||||
LOG.debug("== Getting transport key for %s" % keystone_id)
|
||||
LOG.debug("== Getting transport key for %s", keystone_id)
|
||||
transport_key = self.repo.get(entity_id=self.transport_key_id)
|
||||
if not transport_key:
|
||||
_transport_key_not_found()
|
||||
@@ -139,5 +139,5 @@ class TransportKeysController(object):
|
||||
new_key.id
|
||||
)
|
||||
url = hrefs.convert_transport_key_to_href(new_key.id)
|
||||
LOG.debug('URI to transport key is {0}'.format(url))
|
||||
LOG.debug('URI to transport key is %s', url)
|
||||
return {'transport_key_ref': url}
|
||||
|
||||
@@ -74,13 +74,13 @@ class Debug(Middleware):
|
||||
def __call__(self, req):
|
||||
LOG.debug(("*" * 40) + " REQUEST ENVIRON")
|
||||
for key, value in req.environ.items():
|
||||
LOG.debug('{0}={1}'.format(key, value))
|
||||
LOG.debug('%s=%s', key, value)
|
||||
LOG.debug(' ')
|
||||
resp = req.get_response(self.application)
|
||||
|
||||
LOG.debug(("*" * 40) + " RESPONSE HEADERS")
|
||||
for (key, value) in resp.headers.iteritems():
|
||||
LOG.debug('{0}={1}'.format(key, value))
|
||||
LOG.debug('%s=%s', key, value)
|
||||
LOG.debug(' ')
|
||||
|
||||
resp.app_iter = self.print_generator(resp.app_iter)
|
||||
|
||||
@@ -80,11 +80,11 @@ class ContextMiddleware(BaseContextMiddleware):
|
||||
if req.headers.get('X-Identity-Status') == 'Confirmed':
|
||||
req.context = self._get_authenticated_context(req)
|
||||
LOG.debug("==== Inserted barbican auth "
|
||||
"request context: %s ====" % (req.context.to_dict()))
|
||||
"request context: %s ====", req.context.to_dict())
|
||||
elif CONF.allow_anonymous_access:
|
||||
req.context = self._get_anonymous_context()
|
||||
LOG.debug("==== Inserted barbican unauth "
|
||||
"request context: %s ====" % (req.context.to_dict()))
|
||||
"request context: %s ====", req.context.to_dict())
|
||||
else:
|
||||
raise webob.exc.HTTPUnauthorized()
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ def get_or_create_tenant(keystone_id, tenant_repo):
|
||||
tenant = tenant_repo.find_by_keystone_id(keystone_id,
|
||||
suppress_exception=True)
|
||||
if not tenant:
|
||||
LOG.debug('Creating tenant for {0}'.format(keystone_id))
|
||||
LOG.debug('Creating tenant for %s', keystone_id)
|
||||
tenant = models.Tenant()
|
||||
tenant.keystone_id = keystone_id
|
||||
tenant.status = models.States.ACTIVE
|
||||
|
||||
@@ -627,7 +627,7 @@ MODELS = [TenantSecret, Tenant, Secret, EncryptedDatum, Order, Container,
|
||||
|
||||
def register_models(engine):
|
||||
"""Creates database tables for all models with the given engine."""
|
||||
LOG.debug("Models: {0}".format(repr(MODELS)))
|
||||
LOG.debug("Models: %s", repr(MODELS))
|
||||
for model in MODELS:
|
||||
model.metadata.create_all(engine)
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ def setup_db_env():
|
||||
_MAX_RETRIES = CONF.sql_max_retries
|
||||
_RETRY_INTERVAL = CONF.sql_retry_interval
|
||||
_CONNECTION = CONF.sql_connection
|
||||
LOG.debug("Sql connection = {0}".format(_CONNECTION))
|
||||
LOG.debug("Sql connection = %s", _CONNECTION)
|
||||
sa_logger = logging.getLogger('sqlalchemy.engine')
|
||||
if CONF.debug:
|
||||
sa_logger.setLevel(logging.DEBUG)
|
||||
@@ -118,8 +118,7 @@ def get_engine():
|
||||
'convert_unicode': True}
|
||||
|
||||
try:
|
||||
LOG.debug("Sql connection: {0}; Args: {1}".format(_CONNECTION,
|
||||
engine_args))
|
||||
LOG.debug("Sql connection: %s; Args: %s", _CONNECTION, engine_args)
|
||||
_ENGINE = sqlalchemy.create_engine(_CONNECTION, **engine_args)
|
||||
|
||||
#TODO(jfwood): if 'mysql' in connection_dict.drivername:
|
||||
@@ -232,9 +231,9 @@ def clean_paging_values(offset_arg=0, limit_arg=CONF.default_limit_paging):
|
||||
except ValueError:
|
||||
limit = CONF.default_limit_paging
|
||||
|
||||
LOG.debug("Clean paging values limit={0}, offset={1}".format(
|
||||
limit, offset
|
||||
))
|
||||
LOG.debug("Clean paging values limit=%s, offset=%s",
|
||||
limit, offset
|
||||
)
|
||||
|
||||
return offset, limit
|
||||
|
||||
@@ -303,7 +302,7 @@ class BaseRepo(object):
|
||||
entity = query.one()
|
||||
|
||||
except sa_orm.exc.NoResultFound:
|
||||
LOG.exception("Not found for {0}".format(entity_id))
|
||||
LOG.exception("Not found for %s", entity_id)
|
||||
entity = None
|
||||
if not suppress_exception:
|
||||
raise exception.NotFound("No %s found with ID %s"
|
||||
@@ -343,7 +342,7 @@ class BaseRepo(object):
|
||||
raise exception.Duplicate("Entity ID {0} already exists!"
|
||||
.format(values_id))
|
||||
LOG.debug('Elapsed repo '
|
||||
'create secret:{0}'.format(time.time() - start)) # DEBUG
|
||||
'create secret:%s', (time.time() - start)) # DEBUG
|
||||
|
||||
return entity
|
||||
|
||||
@@ -510,7 +509,7 @@ class TenantRepo(BaseRepo):
|
||||
except sa_orm.exc.NoResultFound:
|
||||
entity = None
|
||||
if not suppress_exception:
|
||||
LOG.exception("Problem getting Tenant {0}".format(keystone_id))
|
||||
LOG.exception("Problem getting Tenant %s", keystone_id)
|
||||
raise exception.NotFound("No %s found with keystone-ID %s"
|
||||
% (self._do_entity_name(),
|
||||
keystone_id))
|
||||
@@ -559,12 +558,12 @@ class SecretRepo(BaseRepo):
|
||||
|
||||
start = offset
|
||||
end = offset + limit
|
||||
LOG.debug('Retrieving from {0} to {1}'.format(start, end))
|
||||
LOG.debug('Retrieving from %s to %s', start, end)
|
||||
total = query.count()
|
||||
entities = query[start:end]
|
||||
LOG.debug('Number entities retrieved: {0} out of {1}'.format(
|
||||
len(entities), total
|
||||
))
|
||||
LOG.debug('Number entities retrieved: %s out of %s',
|
||||
len(entities), total
|
||||
)
|
||||
|
||||
except sa_orm.exc.NoResultFound:
|
||||
entities = None
|
||||
@@ -768,12 +767,12 @@ class OrderRepo(BaseRepo):
|
||||
|
||||
start = offset
|
||||
end = offset + limit
|
||||
LOG.debug('Retrieving from {0} to {1}'.format(start, end))
|
||||
LOG.debug('Retrieving from %s to %s', start, end)
|
||||
total = query.count()
|
||||
entities = query[start:end]
|
||||
LOG.debug('Number entities retrieved: {0} out of {1}'.format(
|
||||
len(entities), total
|
||||
))
|
||||
LOG.debug('Number entities retrieved: %s out of %s',
|
||||
len(entities), total
|
||||
)
|
||||
|
||||
except sa_orm.exc.NoResultFound:
|
||||
entities = None
|
||||
@@ -827,12 +826,12 @@ class ContainerRepo(BaseRepo):
|
||||
|
||||
start = offset
|
||||
end = offset + limit
|
||||
LOG.debug('Retrieving from {0} to {1}'.format(start, end))
|
||||
LOG.debug('Retrieving from %s to %s', start, end)
|
||||
total = query.count()
|
||||
entities = query[start:end]
|
||||
LOG.debug('Number entities retrieved: {0} out of {1}'.format(
|
||||
len(entities), total
|
||||
))
|
||||
LOG.debug('Number entities retrieved: %s out of %s',
|
||||
len(entities), total
|
||||
)
|
||||
|
||||
except sa_orm.exc.NoResultFound:
|
||||
entities = None
|
||||
@@ -886,12 +885,12 @@ class ContainerConsumerRepo(BaseRepo):
|
||||
== container_id)
|
||||
start = offset
|
||||
end = offset + limit
|
||||
LOG.debug('Retrieving from {0} to {1}'.format(start, end))
|
||||
LOG.debug('Retrieving from %s to %s', start, end)
|
||||
total = query.count()
|
||||
entities = query[start:end]
|
||||
LOG.debug('Number entities retrieved: {0} out of {1}'.format(
|
||||
len(entities), total
|
||||
))
|
||||
LOG.debug('Number entities retrieved: %s out of %s',
|
||||
len(entities), total
|
||||
)
|
||||
|
||||
except sa_orm.exc.NoResultFound:
|
||||
entities = None
|
||||
@@ -928,10 +927,9 @@ class ContainerConsumerRepo(BaseRepo):
|
||||
super(ContainerConsumerRepo, self).create_from(new_consumer)
|
||||
except exception.Duplicate:
|
||||
#This operation is idempotent, so log this and move on
|
||||
LOG.debug("Consumer {0} already exists for container {1},"
|
||||
" continuing..."
|
||||
.format((new_consumer.name, new_consumer.URL),
|
||||
new_consumer.container_id))
|
||||
LOG.debug("Consumer %s already exists for container %s,"
|
||||
" continuing...", (new_consumer.name, new_consumer.URL),
|
||||
new_consumer.container_id)
|
||||
#Get the existing entry and reuse it by clearing the deleted flags
|
||||
existing_consumer = self.get_by_values(
|
||||
new_consumer.container_id, new_consumer.name, new_consumer.URL,
|
||||
@@ -992,11 +990,11 @@ class TransportKeyRepo(BaseRepo):
|
||||
|
||||
start = offset
|
||||
end = offset + limit
|
||||
LOG.debug('Retrieving from {0} to {1}'.format(start, end))
|
||||
LOG.debug('Retrieving from %s to %s', start, end)
|
||||
total = query.count()
|
||||
entities = query[start:end]
|
||||
LOG.debug('Number of entities retrieved: {0} out of {1}'.format(
|
||||
len(entities), total))
|
||||
LOG.debug('Number of entities retrieved: %s out of %s',
|
||||
len(entities), total)
|
||||
|
||||
except sa_orm.exc.NoResultFound:
|
||||
entities = None
|
||||
|
||||
@@ -42,7 +42,7 @@ class Tasks(object):
|
||||
"""
|
||||
def process_order(self, context, order_id, keystone_id):
|
||||
"""Process Order."""
|
||||
LOG.debug('Order id is {0}'.format(order_id))
|
||||
LOG.debug('Order id is %s', order_id)
|
||||
task = resources.BeginOrder()
|
||||
try:
|
||||
task.process(order_id, keystone_id)
|
||||
|
||||
@@ -60,7 +60,7 @@ class BaseTask(object):
|
||||
except Exception as e:
|
||||
# Serious error!
|
||||
LOG.exception(u._("Could not retrieve information needed to "
|
||||
"process task '{0}'.").format(name))
|
||||
"process task '%s'."), name)
|
||||
raise e
|
||||
|
||||
# Process the target entity.
|
||||
@@ -68,7 +68,7 @@ class BaseTask(object):
|
||||
self.handle_processing(entity, *args, **kwargs)
|
||||
except Exception as e_orig:
|
||||
LOG.exception(u._("Could not perform processing for "
|
||||
"task '{0}'.").format(name))
|
||||
"task '%s'."), name)
|
||||
|
||||
# Handle failure to process entity.
|
||||
try:
|
||||
@@ -77,9 +77,9 @@ class BaseTask(object):
|
||||
self.handle_error(entity, status, message, e_orig,
|
||||
*args, **kwargs)
|
||||
except Exception:
|
||||
LOG.exception(u._("Problem handling an error for task '{0}', "
|
||||
LOG.exception(u._("Problem handling an error for task '%s', "
|
||||
"raising original "
|
||||
"exception.").format(name))
|
||||
"exception."), name)
|
||||
raise e_orig
|
||||
|
||||
# Handle successful conclusion of processing.
|
||||
@@ -87,7 +87,7 @@ class BaseTask(object):
|
||||
self.handle_success(entity, *args, **kwargs)
|
||||
except Exception as e:
|
||||
LOG.exception(u._("Could not process after successfully executing"
|
||||
" task '{0}'.").format(name))
|
||||
" task '%s'."), name)
|
||||
raise e
|
||||
|
||||
@abc.abstractmethod
|
||||
|
||||
Reference in New Issue
Block a user