Merge "Replaced calls of get(foo, None) -> get(foo)"
This commit is contained in:
commit
bfddf66ec4
|
@ -240,11 +240,11 @@ class CacheFilter(wsgi.Middleware):
|
||||||
return resp
|
return resp
|
||||||
|
|
||||||
def _process_GET_response(self, resp, image_id):
|
def _process_GET_response(self, resp, image_id):
|
||||||
image_checksum = resp.headers.get('Content-MD5', None)
|
image_checksum = resp.headers.get('Content-MD5')
|
||||||
|
|
||||||
if not image_checksum:
|
if not image_checksum:
|
||||||
# API V1 stores the checksum in a different header:
|
# API V1 stores the checksum in a different header:
|
||||||
image_checksum = resp.headers.get('x-image-meta-checksum', None)
|
image_checksum = resp.headers.get('x-image-meta-checksum')
|
||||||
|
|
||||||
if not image_checksum:
|
if not image_checksum:
|
||||||
LOG.error(_("Checksum header is missing."))
|
LOG.error(_("Checksum header is missing."))
|
||||||
|
|
|
@ -868,7 +868,7 @@ class Controller(controller.BaseController):
|
||||||
activating = orig_status == 'queued' and (location or image_data)
|
activating = orig_status == 'queued' and (location or image_data)
|
||||||
|
|
||||||
# Make image public in the backend store (if implemented)
|
# Make image public in the backend store (if implemented)
|
||||||
orig_or_updated_loc = location or orig_image_meta.get('location', None)
|
orig_or_updated_loc = location or orig_image_meta.get('location')
|
||||||
if orig_or_updated_loc:
|
if orig_or_updated_loc:
|
||||||
try:
|
try:
|
||||||
self.update_store_acls(req, id, orig_or_updated_loc,
|
self.update_store_acls(req, id, orig_or_updated_loc,
|
||||||
|
|
|
@ -81,7 +81,7 @@ def upload_data_to_store(req, image_meta, image_data, store, notifier):
|
||||||
image_id = image_meta['id']
|
image_id = image_meta['id']
|
||||||
|
|
||||||
db_api = glance.db.get_api()
|
db_api = glance.db.get_api()
|
||||||
image_size = image_meta.get('size', None)
|
image_size = image_meta.get('size')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
remaining = glance.api.common.check_quota(
|
remaining = glance.api.common.check_quota(
|
||||||
|
|
|
@ -508,7 +508,7 @@ class RequestDeserializer(wsgi.JSONRequestDeserializer):
|
||||||
return member_status
|
return member_status
|
||||||
|
|
||||||
def _get_filters(self, filters):
|
def _get_filters(self, filters):
|
||||||
visibility = filters.get('visibility', None)
|
visibility = filters.get('visibility')
|
||||||
if visibility:
|
if visibility:
|
||||||
if visibility not in ['public', 'private', 'shared']:
|
if visibility not in ['public', 'private', 'shared']:
|
||||||
msg = _('Invalid visibility value: %s') % visibility
|
msg = _('Invalid visibility value: %s') % visibility
|
||||||
|
|
|
@ -137,13 +137,13 @@ class RequestDeserializer(wsgi.JSONRequestDeserializer):
|
||||||
return sort_dir
|
return sort_dir
|
||||||
|
|
||||||
def _get_filters(self, filters):
|
def _get_filters(self, filters):
|
||||||
status = filters.get('status', None)
|
status = filters.get('status')
|
||||||
if status:
|
if status:
|
||||||
if status not in ['pending', 'processing', 'success', 'failure']:
|
if status not in ['pending', 'processing', 'success', 'failure']:
|
||||||
msg = _('Invalid status value: %s') % status
|
msg = _('Invalid status value: %s') % status
|
||||||
raise webob.exc.HTTPBadRequest(explanation=msg)
|
raise webob.exc.HTTPBadRequest(explanation=msg)
|
||||||
|
|
||||||
type = filters.get('type', None)
|
type = filters.get('type')
|
||||||
if type:
|
if type:
|
||||||
if type not in ['import']:
|
if type not in ['import']:
|
||||||
msg = _('Invalid type value: %s') % type
|
msg = _('Invalid type value: %s') % type
|
||||||
|
|
|
@ -524,7 +524,7 @@ def image_create(context, image_values):
|
||||||
image = _image_format(image_id, **image_values)
|
image = _image_format(image_id, **image_values)
|
||||||
DATA['images'][image_id] = image
|
DATA['images'][image_id] = image
|
||||||
|
|
||||||
location_data = image_values.get('locations', None)
|
location_data = image_values.get('locations')
|
||||||
if location_data is not None:
|
if location_data is not None:
|
||||||
_image_locations_set(image_id, location_data)
|
_image_locations_set(image_id, location_data)
|
||||||
|
|
||||||
|
|
|
@ -584,7 +584,7 @@ def _validate_image(values):
|
||||||
:param values: Mapping of image metadata to check
|
:param values: Mapping of image metadata to check
|
||||||
"""
|
"""
|
||||||
|
|
||||||
status = values.get('status', None)
|
status = values.get('status')
|
||||||
if not status:
|
if not status:
|
||||||
msg = "Image status is required."
|
msg = "Image status is required."
|
||||||
raise exception.Invalid(msg)
|
raise exception.Invalid(msg)
|
||||||
|
|
Loading…
Reference in New Issue