Ensure that method's default argument shouldn't be mutable

Fix issues from pep8

Change-Id: I46100993ddaae4b21f0978c4b045f7346f166b9b
This commit is contained in:
Gary Kotton 2015-11-02 06:06:38 -08:00
parent dc6c85197c
commit 3073d6debb
3 changed files with 12 additions and 7 deletions

View File

@ -163,7 +163,8 @@ class NetworkGatewayMixin(networkgw.NetworkGatewayPluginBase):
return network_id return network_id
def _retrieve_gateway_connections(self, context, gateway_id, def _retrieve_gateway_connections(self, context, gateway_id,
mapping_info={}, only_one=False): mapping_info=None, only_one=False):
mapping_info = mapping_info or {}
filters = {'network_gateway_id': [gateway_id]} filters = {'network_gateway_id': [gateway_id]}
for k, v in six.iteritems(mapping_info): for k, v in six.iteritems(mapping_info):
if v and k != NETWORK_ID: if v and k != NETWORK_ID:

View File

@ -168,10 +168,12 @@ class LogicalPort(AbstractRESTResource):
def _build_body_attrs( def _build_body_attrs(
self, display_name=None, self, display_name=None,
admin_state=True, tags=[], admin_state=True, tags=None,
address_bindings=[], address_bindings=None,
switch_profile_ids=[]): switch_profile_ids=None):
tags = tags or []
address_bindings = address_bindings or []
switch_profile_ids = switch_profile_ids or []
body = {} body = {}
if tags: if tags:
body['tags'] = tags body['tags'] = tags
@ -207,11 +209,12 @@ class LogicalPort(AbstractRESTResource):
return body return body
def create(self, lswitch_id, vif_uuid, tags=[], def create(self, lswitch_id, vif_uuid, tags=None,
attachment_type=nsx_constants.ATTACHMENT_VIF, attachment_type=nsx_constants.ATTACHMENT_VIF,
admin_state=True, name=None, address_bindings=None, admin_state=True, name=None, address_bindings=None,
parent_name=None, parent_tag=None, parent_name=None, parent_tag=None,
switch_profile_ids=None): switch_profile_ids=None):
tags = tags or []
# NOTE(arosen): if a parent_name is specified we need to use the # NOTE(arosen): if a parent_name is specified we need to use the
# CIF's attachment. # CIF's attachment.

View File

@ -1519,7 +1519,8 @@ def clear_gateway(nsxv_manager, context, router_id):
def update_external_interface( def update_external_interface(
nsxv_manager, context, router_id, ext_net_id, nsxv_manager, context, router_id, ext_net_id,
ipaddr, netmask, secondary=[]): ipaddr, netmask, secondary=None):
secondary = secondary or []
binding = nsxv_db.get_nsxv_router_binding(context.session, router_id) binding = nsxv_db.get_nsxv_router_binding(context.session, router_id)
net_bindings = nsxv_db.get_network_bindings(context.session, ext_net_id) net_bindings = nsxv_db.get_network_bindings(context.session, ext_net_id)
if not net_bindings: if not net_bindings: