Merge "Change string generation mechanism for info logging"

This commit is contained in:
Jenkins 2015-10-09 18:24:13 +00:00 committed by Gerrit Code Review
commit 7ba2346795
26 changed files with 95 additions and 137 deletions

View File

@ -709,7 +709,7 @@ class Controller(controller.BaseController):
location_data = self._upload(req, image_meta)
image_id = image_meta['id']
LOG.info(_LI("Uploaded data of image %s from request "
"payload successfully.") % image_id)
"payload successfully."), image_id)
if location_data:
try:

View File

@ -124,7 +124,7 @@ def upload_data_to_store(req, image_meta, image_data, store, notifier):
except exception.StorageQuotaFull:
with excutils.save_and_reraise_exception():
LOG.info(_LI('Cleaning up %s after exceeding '
'the quota') % image_id)
'the quota'), image_id)
store_utils.safe_delete_from_backend(
req.context, image_meta['id'], location_data)
@ -179,8 +179,8 @@ def upload_data_to_store(req, image_meta, image_data, store, notifier):
initiate_deletion(req, location_data, image_id)
raise webob.exc.HTTPUnauthorized(explanation=e.msg, request=req)
except exception.ImageNotFound:
msg = _LI("Image %s could not be found after upload. The image may"
" have been deleted during the upload.") % image_id
msg = _("Image %s could not be found after upload. The image may"
" have been deleted during the upload.") % image_id
LOG.info(msg)
# NOTE(jculp): we need to clean up the datastore if an image

View File

@ -48,7 +48,7 @@ class ImageActionsController(object):
image = image_repo.get(image_id)
image.deactivate()
image_repo.save(image)
LOG.info(_LI("Image %s is deactivated") % image_id)
LOG.info(_LI("Image %s is deactivated"), image_id)
except exception.NotFound as e:
raise webob.exc.HTTPNotFound(explanation=e.msg)
except exception.Forbidden as e:
@ -64,7 +64,7 @@ class ImageActionsController(object):
image = image_repo.get(image_id)
image.reactivate()
image_repo.save(image)
LOG.info(_LI("Image %s is reactivated") % image_id)
LOG.info(_LI("Image %s is reactivated"), image_id)
except exception.NotFound as e:
raise webob.exc.HTTPNotFound(explanation=e.msg)
except exception.Forbidden as e:

View File

@ -373,7 +373,7 @@ class _CompleteTask(task.Task):
finally:
self.task_repo.save(task)
LOG.info(_LI("%(task_id)s of %(task_type)s completed") %
LOG.info(_LI("%(task_id)s of %(task_type)s completed"),
{'task_id': self.task_id, 'task_type': self.task_type})

View File

@ -371,7 +371,7 @@ def replication_dump(options, args):
data_path = os.path.join(path, image['id'])
if not os.path.exists(data_path):
LOG.info(_LI('Storing: %s') % image['id'])
LOG.info(_LI('Storing: %s'), image['id'])
# Dump glance information
if six.PY3:
@ -448,7 +448,7 @@ def replication_load(options, args):
for ent in os.listdir(path):
if utils.is_uuid_like(ent):
image_uuid = ent
LOG.info(_LI('Considering: %s') % image_uuid)
LOG.info(_LI('Considering: %s'), image_uuid)
meta_file_name = os.path.join(path, image_uuid)
with open(meta_file_name) as meta_file:
@ -474,8 +474,7 @@ def replication_load(options, args):
del headers[key]
if _dict_diff(meta, headers):
LOG.info(_LI('Image %s metadata has changed') %
image_uuid)
LOG.info(_LI('Image %s metadata has changed'), image_uuid)
headers, body = client.add_image_meta(meta)
_check_upload_response_headers(headers, body)
updated.append(meta['id'])
@ -549,14 +548,13 @@ def replication_livecopy(options, args):
del headers[key]
if _dict_diff(image, headers):
LOG.info(_LI('Image %s metadata has changed') %
image['id'])
LOG.info(_LI('Image %s metadata has changed'), image['id'])
headers, body = slave_client.add_image_meta(image)
_check_upload_response_headers(headers, body)
updated.append(image['id'])
elif image['status'] == 'active':
LOG.info(_LI('Image %s is being synced') % image['id'])
LOG.info(_LI('Image %s is being synced'), image['id'])
if not options.metaonly:
image_response = master_client.get_image(image['id'])
try:

View File

@ -128,7 +128,7 @@ class ArtifactsPluginLoader(object):
def _all_allowed(ext):
LOG.info(
_LI("Artifact %s has been successfully loaded") % ext.name)
_LI("Artifact %s has been successfully loaded"), ext.name)
return True
if not CONF.load_enabled:
@ -152,7 +152,7 @@ class ArtifactsPluginLoader(object):
" available_plugins list") % ext.name)
raise exception.ArtifactLoadError(name=ext.name)
LOG.info(
_LI("Artifact %s has been successfully loaded") % ext.name)
_LI("Artifact %s has been successfully loaded"), ext.name)
return True
return _check_ext

View File

@ -39,7 +39,7 @@ _LW = i18n._LW
def run(t_id, context, task_repo, image_repo, image_factory):
LOG.info(_LI('Task %(task_id)s beginning import '
'execution.') % {'task_id': t_id})
'execution.'), {'task_id': t_id})
_execute(t_id, task_repo, image_repo, image_factory)
@ -151,7 +151,7 @@ def set_image_data(image, uri, task_id):
data_iter = None
try:
LOG.info(_LI("Task %(task_id)s: Got image data uri %(data_uri)s to be "
"imported") % {"data_uri": uri, "task_id": task_id})
"imported"), {"data_uri": uri, "task_id": task_id})
data_iter = script_utils.get_image_data_iter(uri)
image.set_data(data_iter)
except Exception as e:
@ -160,8 +160,8 @@ def set_image_data(image, uri, task_id):
{"error": encodeutils.exception_to_unicode(e),
"task_id": task_id})
LOG.info(_LI("Task %(task_id)s: Could not import image file"
" %(image_data)s") % {"image_data": uri,
"task_id": task_id})
" %(image_data)s"), {"image_data": uri,
"task_id": task_id})
finally:
if isinstance(data_iter, file):
data_iter.close()

View File

@ -308,7 +308,7 @@ class Server(object):
self.pool.spawn_n(self._single_run, self.application, self.sock)
return
else:
LOG.info(_LI("Starting %d workers") % CONF.workers)
LOG.info(_LI("Starting %d workers"), CONF.workers)
signal.signal(signal.SIGTERM, self.kill_children)
signal.signal(signal.SIGINT, self.kill_children)
signal.signal(signal.SIGHUP, self.hup)
@ -321,10 +321,10 @@ class Server(object):
def _remove_children(self, pid):
if pid in self.children:
self.children.remove(pid)
LOG.info(_LI('Removed dead child %s') % pid)
LOG.info(_LI('Removed dead child %s'), pid)
elif pid in self.stale_children:
self.stale_children.remove(pid)
LOG.info(_LI('Removed stale child %s') % pid)
LOG.info(_LI('Removed stale child %s'), pid)
else:
LOG.warn(_LW('Unrecognised child %s') % pid)
@ -433,12 +433,12 @@ class Server(object):
# exit on sighup
self._sock = None
self.run_server()
LOG.info(_LI('Child %d exiting normally') % os.getpid())
LOG.info(_LI('Child %d exiting normally'), os.getpid())
# self.pool.waitall() is now called in wsgi's server so
# it's safe to exit here
sys.exit(0)
else:
LOG.info(_LI('Started child %s') % pid)
LOG.info(_LI('Started child %s'), pid)
self.children.add(pid)
def run_server(self):

View File

@ -60,12 +60,12 @@ def log_call(func):
@functools.wraps(func)
def wrapped(*args, **kwargs):
LOG.info(_LI('Calling %(funcname)s: args=%(args)s, '
'kwargs=%(kwargs)s') %
'kwargs=%(kwargs)s'),
{"funcname": func.__name__,
"args": args,
"kwargs": kwargs})
output = func(*args, **kwargs)
LOG.info(_LI('Returning %(funcname)s: %(output)s') %
LOG.info(_LI('Returning %(funcname)s: %(output)s'),
{"funcname": func.__name__,
"output": output})
return output
@ -2000,7 +2000,7 @@ def _artifact_get(context, artifact_id, type_name,
artifact['type_version'] != type_version)):
raise KeyError
except KeyError:
LOG.info(_LI('Could not find artifact %s') % artifact_id)
LOG.info(_LI('Could not find artifact %s'), artifact_id)
raise exception.NotFound()
if artifact['deleted_at']:

View File

@ -450,7 +450,7 @@ def _export_data_to_file(meta, path):
json_file.write(json.dumps(values))
except Exception as e:
LOG.exception(encodeutils.exception_to_unicode(e))
LOG.info(_LI("Namespace %(namespace)s saved in %(file)s") % {
LOG.info(_LI("Namespace %(namespace)s saved in %(file)s"), {
'namespace': namespace_file_name, 'file': file_name})

View File

@ -98,11 +98,11 @@ def from_migration_import(module_name, fromlist):
def create_tables(tables):
for table in tables:
LOG.info(_LI("creating table %(table)s") % {'table': table})
LOG.info(_LI("creating table %(table)s"), {'table': table})
table.create()
def drop_tables(tables):
for table in tables:
LOG.info(_LI("dropping table %(table)s") % {'table': table})
LOG.info(_LI("dropping table %(table)s"), {'table': table})
table.drop()

View File

@ -403,18 +403,16 @@ class Task(object):
def _set_task_status(self, new_status):
if self._validate_task_status_transition(self.status, new_status):
self._status = new_status
log_msg = (_LI("Task [%(task_id)s] status changing from "
"%(cur_status)s to %(new_status)s") %
{'task_id': self.task_id, 'cur_status': self.status,
'new_status': new_status})
LOG.info(log_msg)
LOG.info(_LI("Task [%(task_id)s] status changing from "
"%(cur_status)s to %(new_status)s"),
{'task_id': self.task_id, 'cur_status': self.status,
'new_status': new_status})
self._status = new_status
else:
log_msg = (_LE("Task [%(task_id)s] status failed to change from "
"%(cur_status)s to %(new_status)s") %
{'task_id': self.task_id, 'cur_status': self.status,
'new_status': new_status})
LOG.error(log_msg)
LOG.error(_LE("Task [%(task_id)s] status failed to change from "
"%(cur_status)s to %(new_status)s"),
{'task_id': self.task_id, 'cur_status': self.status,
'new_status': new_status})
raise exception.InvalidTaskStatusTransition(
cur_status=self.status,
new_status=new_status

View File

@ -14,7 +14,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import glance_store
from oslo_log import log as logging
from glance.api import authorization
from glance.api import policy
@ -28,9 +27,6 @@ import glance.notifier
import glance.quota
LOG = logging.getLogger(__name__)
class Gateway(object):
def __init__(self, db_api=None, store_api=None, notifier=None,
policy_enforcer=None):

View File

@ -69,8 +69,7 @@ class ImageCache(object):
driver_module = (__name__ + '.drivers.' + driver_name + '.Driver')
try:
self.driver_class = importutils.import_class(driver_module)
LOG.info(_LI("Image cache loaded driver '%s'.") %
driver_name)
LOG.info(_LI("Image cache loaded driver '%s'."), driver_name)
except ImportError as import_err:
LOG.warn(_LW("Image cache driver "
"'%(driver_name)s' failed to load. "

View File

@ -410,19 +410,16 @@ class Driver(base.Driver):
:param image_id: Image ID
"""
if self.is_cached(image_id):
msg = _LI("Not queueing image '%s'. Already cached.") % image_id
LOG.info(msg)
LOG.info(_LI("Not queueing image '%s'. Already cached."), image_id)
return False
if self.is_being_cached(image_id):
msg = _LI("Not queueing image '%s'. Already being "
"written to cache") % image_id
LOG.info(msg)
LOG.info(_LI("Not queueing image '%s'. Already being "
"written to cache"), image_id)
return False
if self.is_queued(image_id):
msg = _LI("Not queueing image '%s'. Already queued.") % image_id
LOG.info(msg)
LOG.info(_LI("Not queueing image '%s'. Already queued."), image_id)
return False
path = self.get_image_filepath(image_id, 'queue')
@ -439,7 +436,7 @@ class Driver(base.Driver):
"""
for path in self.get_cache_files(self.invalid_dir):
os.unlink(path)
LOG.info(_LI("Removed invalid cache file %s") % path)
LOG.info(_LI("Removed invalid cache file %s"), path)
def delete_stalled_files(self, older_than):
"""
@ -453,7 +450,7 @@ class Driver(base.Driver):
if os.path.getmtime(path) < older_than:
try:
os.unlink(path)
LOG.info(_LI("Removed stalled cache file %s") % path)
LOG.info(_LI("Removed stalled cache file %s"), path)
except Exception as e:
msg = (_LW("Failed to delete file %(path)s. "
"Got error: %(e)s"),

View File

@ -339,19 +339,16 @@ class Driver(base.Driver):
:param image_id: Image ID
"""
if self.is_cached(image_id):
msg = _LI("Not queueing image '%s'. Already cached.") % image_id
LOG.info(msg)
LOG.info(_LI("Not queueing image '%s'. Already cached."), image_id)
return False
if self.is_being_cached(image_id):
msg = _LI("Not queueing image '%s'. Already being "
"written to cache") % image_id
LOG.info(msg)
LOG.info(_LI("Not queueing image '%s'. Already being "
"written to cache"), image_id)
return False
if self.is_queued(image_id):
msg = _LI("Not queueing image '%s'. Already queued.") % image_id
LOG.info(msg)
LOG.info(_LI("Not queueing image '%s'. Already queued."), image_id)
return False
path = self.get_image_filepath(image_id, 'queue')

View File

@ -82,5 +82,5 @@ class Prefetcher(base.CacheApp):
"images in queue."))
return False
LOG.info(_LI("Successfully cached all %d images") % num_images)
LOG.info(_LI("Successfully cached all %d images"), num_images)
return True

View File

@ -395,9 +395,8 @@ class ImageProxy(glance.domain.proxy.Image):
result = signature_utils.verify_signature(
self.context, checksum, self.image.extra_properties)
if result:
msg = (_LI("Successfully verified signature for image "
"%s") % self.image.image_id)
LOG.info(msg)
LOG.info(_LI("Successfully verified signature for image %s"),
self.image.image_id)
self.image.locations = [{'url': location, 'metadata': loc_meta,
'status': 'active'}]

View File

@ -327,8 +327,8 @@ class ImageProxy(glance.domain.proxy.Image):
image_id=self.image.image_id)
except exception.StorageQuotaFull:
with excutils.save_and_reraise_exception():
LOG.info(_LI('Cleaning up %s after exceeding the quota.')
% self.image.image_id)
LOG.info(_LI('Cleaning up %s after exceeding the quota.'),
self.image.image_id)
self.store_utils.safe_delete_from_backend(
self.context, self.image.image_id, self.image.locations[0])

View File

@ -341,15 +341,13 @@ class Controller(object):
msg = "Successfully retrieved image %(id)s" % {'id': id}
LOG.debug(msg)
except exception.ImageNotFound:
msg = _LI("Image %(id)s not found") % {'id': id}
LOG.info(msg)
LOG.info(_LI("Image %(id)s not found"), {'id': id})
raise exc.HTTPNotFound()
except exception.Forbidden:
# If it's private and doesn't belong to them, don't let on
# that it exists
msg = _LI("Access denied to image %(id)s but returning"
" 'not found'") % {'id': id}
LOG.info(msg)
LOG.info(_LI("Access denied to image %(id)s but returning"
" 'not found'"), {'id': id})
raise exc.HTTPNotFound()
except Exception:
LOG.exception(_LE("Unable to show image %s") % id)
@ -369,23 +367,19 @@ class Controller(object):
"""
try:
deleted_image = self.db_api.image_destroy(req.context, id)
msg = _LI("Successfully deleted image %(id)s") % {'id': id}
LOG.info(msg)
LOG.info(_LI("Successfully deleted image %(id)s"), {'id': id})
return dict(image=make_image_dict(deleted_image))
except exception.ForbiddenPublicImage:
msg = _LI("Delete denied for public image %(id)s") % {'id': id}
LOG.info(msg)
LOG.info(_LI("Delete denied for public image %(id)s"), {'id': id})
raise exc.HTTPForbidden()
except exception.Forbidden:
# If it's private and doesn't belong to them, don't let on
# that it exists
msg = _LI("Access denied to image %(id)s but returning"
" 'not found'") % {'id': id}
LOG.info(msg)
LOG.info(_LI("Access denied to image %(id)s but returning"
" 'not found'"), {'id': id})
return exc.HTTPNotFound()
except exception.ImageNotFound:
msg = _LI("Image %(id)s not found") % {'id': id}
LOG.info(msg)
LOG.info(_LI("Image %(id)s not found"), {'id': id})
return exc.HTTPNotFound()
except Exception:
LOG.exception(_LE("Unable to delete image %s") % id)
@ -413,9 +407,8 @@ class Controller(object):
image_id = image_data.get('id')
if image_id and not utils.is_uuid_like(image_id):
msg = _LI("Rejecting image creation request for invalid image "
"id '%(bad_id)s'") % {'bad_id': image_id}
LOG.info(msg)
LOG.info(_LI("Rejecting image creation request for invalid image "
"id '%(bad_id)s'"), {'bad_id': image_id})
msg = _("Invalid image id format")
return exc.HTTPBadRequest(explanation=msg)
@ -426,9 +419,8 @@ class Controller(object):
image_data = _normalize_image_location_for_db(image_data)
image_data = self.db_api.image_create(req.context, image_data)
image_data = dict(image=make_image_dict(image_data))
msg = (_LI("Successfully created image %(id)s") %
image_data['image'])
LOG.info(msg)
LOG.info(_LI("Successfully created image %(id)s"),
{'id': image_data['image']['id']})
return image_data
except exception.Duplicate:
msg = _("Image with identifier %s already exists!") % image_id
@ -480,8 +472,7 @@ class Controller(object):
purge_props=purge_props,
from_state=from_state)
msg = _LI("Updating metadata for image %(id)s") % {'id': id}
LOG.info(msg)
LOG.info(_LI("Updating metadata for image %(id)s"), {'id': id})
return dict(image=make_image_dict(updated_image))
except exception.Invalid as e:
msg = (_("Failed to update image metadata. "
@ -489,21 +480,18 @@ class Controller(object):
LOG.error(msg)
return exc.HTTPBadRequest(msg)
except exception.ImageNotFound:
msg = _LI("Image %(id)s not found") % {'id': id}
LOG.info(msg)
LOG.info(_LI("Image %(id)s not found"), {'id': id})
raise exc.HTTPNotFound(body='Image not found',
request=req,
content_type='text/plain')
except exception.ForbiddenPublicImage:
msg = _LI("Update denied for public image %(id)s") % {'id': id}
LOG.info(msg)
LOG.info(_LI("Update denied for public image %(id)s"), {'id': id})
raise exc.HTTPForbidden()
except exception.Forbidden:
# If it's private and doesn't belong to them, don't let on
# that it exists
msg = _LI("Access denied to image %(id)s but returning"
" 'not found'") % {'id': id}
LOG.info(msg)
LOG.info(_LI("Access denied to image %(id)s but returning"
" 'not found'"), {'id': id})
raise exc.HTTPNotFound(body='Image not found',
request=req,
content_type='text/plain')

View File

@ -80,8 +80,7 @@ class Controller(object):
raise webob.exc.HTTPNotFound()
members = self.db_api.image_member_find(req.context, image_id=image_id)
msg = "Returning member list for image %(id)s" % {'id': image_id}
LOG.debug(msg)
LOG.debug("Returning member list for image %(id)s", {'id': image_id})
return dict(members=make_member_list(members,
member_id='member',
can_share='can_share'))
@ -197,9 +196,8 @@ class Controller(object):
self.db_api.image_member_create(req.context, memb)
# Make an appropriate result
msg = (_LI("Successfully updated memberships for image %(id)s") %
{'id': image_id})
LOG.info(msg)
LOG.info(_LI("Successfully updated memberships for image %(id)s"),
{'id': image_id})
return webob.exc.HTTPNoContent()
@utils.mutating
@ -271,9 +269,8 @@ class Controller(object):
can_share=bool(can_share))
self.db_api.image_member_create(req.context, values)
msg = (_LI("Successfully updated a membership for image %(id)s") %
{'id': image_id})
LOG.info(msg)
LOG.info(_LI("Successfully updated a membership for image %(id)s"),
{'id': image_id})
return webob.exc.HTTPNoContent()
@utils.mutating
@ -313,21 +310,19 @@ class Controller(object):
if members:
self.db_api.image_member_delete(req.context, members[0]['id'])
else:
msg = ("%(id)s is not a member of image %(image_id)s" %
{'id': id, 'image_id': image_id})
LOG.debug(msg)
LOG.debug("%(id)s is not a member of image %(image_id)s",
{'id': id, 'image_id': image_id})
msg = _("Membership could not be found.")
raise webob.exc.HTTPNotFound(explanation=msg)
# Make an appropriate result
msg = (_LI("Successfully deleted a membership from image %(id)s") %
{'id': image_id})
LOG.info(msg)
LOG.info(_LI("Successfully deleted a membership from image %(id)s"),
{'id': image_id})
return webob.exc.HTTPNoContent()
def default(self, req, *args, **kwargs):
"""This will cover the missing 'show' and 'create' actions"""
LOG.debug("The method %s is not allowed for this resource" %
LOG.debug("The method %s is not allowed for this resource",
req.environ['REQUEST_METHOD'])
raise webob.exc.HTTPMethodNotAllowed(
headers=[('Allow', 'PUT, DELETE')])
@ -344,8 +339,8 @@ class Controller(object):
msg = _("Membership could not be found.")
raise webob.exc.HTTPBadRequest(explanation=msg)
msg = "Returning list of images shared with member %(id)s" % {'id': id}
LOG.debug(msg)
LOG.debug("Returning list of images shared with member %(id)s",
{'id': id})
return dict(shared_images=make_member_list(members,
image_id='image_id',
can_share='can_share'))

View File

@ -18,15 +18,12 @@ RPC Controller
"""
from oslo_config import cfg
from oslo_log import log as logging
from glance.common import rpc
from glance.common import wsgi
import glance.db
from glance import i18n
LOG = logging.getLogger(__name__)
_ = i18n._
CONF = cfg.CONF

View File

@ -18,12 +18,8 @@ Simple client class to speak with any RESTful service that implements
the Glance Registry API
"""
from oslo_log import log as logging
from glance.common import rpc
LOG = logging.getLogger(__name__)
class RegistryClient(rpc.RPCClient):
"""Registry's V2 Client."""

View File

@ -240,7 +240,7 @@ class Daemon(object):
class Scrubber(object):
def __init__(self, store_api):
LOG.info(_LI("Initializing scrubber with configuration: %s") %
LOG.info(_LI("Initializing scrubber with configuration: %s"),
six.text_type({'registry_host': CONF.registry_host,
'registry_port': CONF.registry_port}))
@ -298,7 +298,7 @@ class Scrubber(object):
if len(delete_jobs) == 0:
return
LOG.info(_LI("Scrubbing image %(id)s from %(count)d locations.") %
LOG.info(_LI("Scrubbing image %(id)s from %(count)d locations."),
{'id': image_id, 'count': len(delete_jobs)})
success = True
@ -312,7 +312,7 @@ class Scrubber(object):
image = self.registry.get_image(image_id)
if image['status'] == 'pending_delete':
self.registry.update_image(image_id, {'status': 'deleted'})
LOG.info(_LI("Image %s has been scrubbed successfully") % image_id)
LOG.info(_LI("Image %s has been scrubbed successfully"), image_id)
else:
LOG.warn(_LW("One or more image locations couldn't be scrubbed "
"from backend. Leaving image '%s' in 'pending_delete'"
@ -328,14 +328,14 @@ class Scrubber(object):
except store_exceptions.NotFound:
LOG.info(_LI("Image location for image '%s' not found in "
"backend; Marking image location deleted in "
"db.") % image_id)
"db."), image_id)
if loc_id != '-':
db_api.get_api().image_location_delete(self.admin_context,
image_id,
int(loc_id),
'deleted')
LOG.info(_LI("Image %s is scrubbed from a location.") % image_id)
LOG.info(_LI("Image %s is scrubbed from a location."), image_id)
except Exception as e:
LOG.error(_LE("Unable to scrub image %(id)s from a location. "
"Reason: %(exc)s ") %

View File

@ -45,7 +45,6 @@ UUID2 = _gen_uuid()
class TestRegistryAPI(base.IsolatedUnitTest, test_utils.RegistryAPIMixIn):
def setUp(self):
"""Establish a clean test environment"""
super(TestRegistryAPI, self).setUp()
@ -1285,10 +1284,11 @@ class TestRegistryAPI(base.IsolatedUnitTest, test_utils.RegistryAPIMixIn):
id='0564c64c-3545-4e34-abfb-9d18e5f2f2f9')
self.log_image_id = False
def fake_log_info(msg):
if ('Successfully created image '
'0564c64c-3545-4e34-abfb-9d18e5f2f2f9' in msg):
def fake_log_info(msg, image_data):
if ('0564c64c-3545-4e34-abfb-9d18e5f2f2f9' == image_data['id'] and
'Successfully created image' in msg):
self.log_image_id = True
self.stubs.Set(rserver.images.LOG, 'info', fake_log_info)
self.get_api_response_ext(200, content_type='json', method='POST',
@ -1837,7 +1837,6 @@ class TestRegistryAPI(base.IsolatedUnitTest, test_utils.RegistryAPIMixIn):
class TestRegistryAPILocations(base.IsolatedUnitTest,
test_utils.RegistryAPIMixIn):
def setUp(self):
"""Establish a clean test environment"""
super(TestRegistryAPILocations, self).setUp()
@ -1961,7 +1960,6 @@ class TestRegistryAPILocations(base.IsolatedUnitTest,
class TestSharability(test_utils.BaseTestCase):
def setUp(self):
super(TestSharability, self).setUp()
self.setup_db()

View File

@ -64,9 +64,9 @@ def build_image_owner_map(owner_map, db, context):
image_owner_map[image_id] = owner_id
msg = (_LI('Image "%(image)s" owner "%(owner)s" -> "%(owner_id)s"'),
{'image': image_id, 'owner': owner_name, 'owner_id': owner_id})
LOG.info(msg)
LOG.info(_LI('Image "%(image)s" owner "%(owner)s" -> "%(owner_id)s"'),
{'image': image_id, 'owner': owner_name,
'owner_id': owner_id})
return image_owner_map
@ -74,7 +74,7 @@ def build_image_owner_map(owner_map, db, context):
def update_image_owners(image_owner_map, db, context):
for (image_id, image_owner) in image_owner_map.items():
db.image_update(context, image_id, {'owner': image_owner})
LOG.info(_LI('Image %s successfully updated.') % image_id)
LOG.info(_LI('Image %s successfully updated.'), image_id)
if __name__ == "__main__":