Remove None
as a redundant argument to dict.get()
`dict.get()` returns `None` by default, if a key wasn't found. Removing `None` as second argument to avoid redundancy. Change-Id: I92fe515c0f920a324ac7dd85577d7ee25a6f20a0
This commit is contained in:
parent
ba159a9ea3
commit
21b3cb445b
@ -36,9 +36,9 @@ class ShareManageMixin(object):
|
||||
# DB layers for 'name' and 'description' API params that are
|
||||
# represented in DB as 'display_name' and 'display_description'
|
||||
# appropriately.
|
||||
name = share_data.get('display_name', share_data.get('name', None))
|
||||
name = share_data.get('display_name', share_data.get('name'))
|
||||
description = share_data.get(
|
||||
'display_description', share_data.get('description', None))
|
||||
'display_description', share_data.get('description'))
|
||||
|
||||
share = {
|
||||
'host': share_data['service_host'],
|
||||
|
@ -141,7 +141,7 @@ class ShareTypesController(wsgi.Controller):
|
||||
share_type = body['share_type']
|
||||
else:
|
||||
share_type = body['volume_type']
|
||||
name = share_type.get('name', None)
|
||||
name = share_type.get('name')
|
||||
specs = share_type.get('extra_specs', {})
|
||||
is_public = share_type.get(
|
||||
'os-share-type-access:is_public',
|
||||
|
@ -65,7 +65,7 @@ class FilterScheduler(base.Scheduler):
|
||||
In the event that the request gets re-scheduled, this entry
|
||||
will signal that the given backend has already been tried.
|
||||
"""
|
||||
retry = filter_properties.get('retry', None)
|
||||
retry = filter_properties.get('retry')
|
||||
if not retry:
|
||||
return
|
||||
hosts = retry['hosts']
|
||||
@ -278,7 +278,7 @@ class FilterScheduler(base.Scheduler):
|
||||
if not exc:
|
||||
return # no exception info from a previous attempt, skip
|
||||
|
||||
hosts = retry.get('hosts', None)
|
||||
hosts = retry.get('hosts')
|
||||
if not hosts:
|
||||
return # no previously attempted hosts, skip
|
||||
|
||||
@ -388,7 +388,7 @@ class FilterScheduler(base.Scheduler):
|
||||
"""
|
||||
elevated = context.elevated()
|
||||
|
||||
shr_types = request_spec.get("share_types", None)
|
||||
shr_types = request_spec.get("share_types")
|
||||
|
||||
weighed_hosts = []
|
||||
|
||||
|
@ -25,7 +25,7 @@ class RetryFilter(base_host.BaseHostFilter):
|
||||
|
||||
def host_passes(self, host_state, filter_properties):
|
||||
"""Skip nodes that have already been attempted."""
|
||||
retry = filter_properties.get('retry', None)
|
||||
retry = filter_properties.get('retry')
|
||||
if not retry:
|
||||
# Re-scheduling is disabled
|
||||
LOG.debug("Re-scheduling is disabled")
|
||||
|
Loading…
Reference in New Issue
Block a user