Merge "Fixes logging in image_import's main module"
This commit is contained in:
commit
39773dfaad
@ -99,10 +99,10 @@ def import_image(image_repo, image_factory, task_input, task_id, uri):
|
||||
new_image.virtual_size = original_image.virtual_size
|
||||
new_image.checksum = original_image.checksum
|
||||
else:
|
||||
msg = _LE("The Image %(image_id)s object being created by this task "
|
||||
"%(task_id)s, is no longer in valid status for further "
|
||||
"processing." % {"image_id": new_image.image_id,
|
||||
"task_id": task_id})
|
||||
msg = _("The Image %(image_id)s object being created by this task "
|
||||
"%(task_id)s, is no longer in valid status for further "
|
||||
"processing.") % {"image_id": new_image.image_id,
|
||||
"task_id": task_id}
|
||||
raise exception.Conflict(msg)
|
||||
image_repo.save(new_image)
|
||||
|
||||
@ -120,9 +120,9 @@ def create_image(image_repo, image_factory, image_properties, task_id):
|
||||
try:
|
||||
properties[key] = image_properties.pop(key)
|
||||
except KeyError:
|
||||
msg = _("Task ID %(task_id)s: Ignoring property %(k)s for setting "
|
||||
"base properties while creating "
|
||||
"Image.") % {'task_id': task_id, 'k': key}
|
||||
msg = ("Task ID %(task_id)s: Ignoring property %(k)s for setting "
|
||||
"base properties while creating "
|
||||
"Image.") % {'task_id': task_id, 'k': key}
|
||||
LOG.debug(msg)
|
||||
|
||||
# NOTE: get the rest of the properties and pass them as
|
||||
|
@ -94,8 +94,8 @@ def validate_location_uri(location):
|
||||
# NOTE: file type uri is being avoided for security reasons,
|
||||
# see LP bug #942118.
|
||||
elif location.startswith("file:///"):
|
||||
msg = ("File based imports are not allowed. Please use a non-local "
|
||||
"source of image data.")
|
||||
msg = _("File based imports are not allowed. Please use a non-local "
|
||||
"source of image data.")
|
||||
# NOTE: raise Exception and let the encompassing block save
|
||||
# the error msg in the task.message.
|
||||
raise StandardError(msg)
|
||||
@ -103,16 +103,15 @@ def validate_location_uri(location):
|
||||
else:
|
||||
#TODO(nikhil): add other supported uris
|
||||
supported = ['http', ]
|
||||
msg = ("The given uri is not valid. Please specify a "
|
||||
"valid uri from the following list of supported uri "
|
||||
"%(supported)s" % {'supported': supported})
|
||||
msg = _("The given uri is not valid. Please specify a "
|
||||
"valid uri from the following list of supported uri "
|
||||
"%(supported)s") % {'supported': supported}
|
||||
raise urllib2.URLError(msg)
|
||||
|
||||
|
||||
def get_image_data_iter(uri):
|
||||
"""
|
||||
The scripts are expected to support only over non-local locations of data.
|
||||
Note the absence of file:// for security reasons, see LP bug #942118.
|
||||
"""The scripts are expected to support only over non-local locations of
|
||||
data. Note the absence of file:// for security reasons, see LP bug #942118.
|
||||
If the above constraint is violated, task should fail.
|
||||
"""
|
||||
# NOTE: Current script supports http location. Other locations
|
||||
|
Loading…
Reference in New Issue
Block a user