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