Merge "Inline "for val in [ref]" statements"

This commit is contained in:
Jenkins 2014-08-31 04:30:34 +00:00 committed by Gerrit Code Review
commit ff2f6c5943
3 changed files with 12 additions and 16 deletions

View File

@ -1295,7 +1295,7 @@ class NetworkProfile_db_mixin(object):
:param net_p: network profile object
"""
if any(net_p[arg] == "" for arg in ["segment_type"]):
if net_p["segment_type"] == "":
msg = _("Arguments segment_type missing"
" for network profile")
LOG.error(msg)

View File

@ -1109,8 +1109,7 @@ def _translate_vip_object_graph(extended_vip, plugin, context):
_trans_prop_name(hm_property))].append(value)
ids = get_ids(extended_vip)
trans_vip['__ids__'] = ids
for key in ['pip_address']:
if key in extended_vip:
trans_vip[key] = extended_vip[key]
if 'pip_address' in extended_vip:
trans_vip['pip_address'] = extended_vip['pip_address']
LOG.debug('Translated Vip graph: ' + str(trans_vip))
return trans_vip

View File

@ -85,9 +85,8 @@ class VPNTestMixin(object):
'pfs': pfs,
'tenant_id': self._tenant_id
}}
for arg in ['description']:
if arg in kwargs and kwargs[arg] is not None:
data['ikepolicy'][arg] = kwargs[arg]
if kwargs.get('description') is not None:
data['ikepolicy']['description'] = kwargs['description']
ikepolicy_req = self.new_create_request('ikepolicies', data, fmt)
ikepolicy_res = ikepolicy_req.get_response(self.ext_api)
@ -148,9 +147,8 @@ class VPNTestMixin(object):
'value': lifetime_value},
'pfs': pfs,
'tenant_id': self._tenant_id}}
for arg in ['description']:
if arg in kwargs and kwargs[arg] is not None:
data['ipsecpolicy'][arg] = kwargs[arg]
if kwargs.get('description') is not None:
data['ipsecpolicy']['description'] = kwargs['description']
ipsecpolicy_req = self.new_create_request('ipsecpolicies', data, fmt)
ipsecpolicy_res = ipsecpolicy_req.get_response(self.ext_api)
if expected_res_status:
@ -198,9 +196,8 @@ class VPNTestMixin(object):
'router_id': router_id,
'admin_state_up': admin_state_up,
'tenant_id': tenant_id}}
for arg in ['description']:
if arg in kwargs and kwargs[arg] is not None:
data['vpnservice'][arg] = kwargs[arg]
if kwargs.get('description') is not None:
data['vpnservice']['description'] = kwargs['description']
vpnservice_req = self.new_create_request('vpnservices', data, fmt)
if (kwargs.get('set_context') and
'tenant_id' in kwargs):
@ -309,9 +306,9 @@ class VPNTestMixin(object):
'admin_state_up': admin_state_up,
'tenant_id': self._tenant_id}
}
for arg in ['description']:
if arg in kwargs and kwargs[arg] is not None:
data['ipsec_site_connection'][arg] = kwargs[arg]
if kwargs.get('description') is not None:
data['ipsec_site_connection'][
'description'] = kwargs['description']
ipsec_site_connection_req = self.new_create_request(
'ipsec-site-connections', data, fmt