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
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]}
for k, v in six.iteritems(mapping_info):
if v and k != NETWORK_ID:

View File

@ -168,10 +168,12 @@ class LogicalPort(AbstractRESTResource):
def _build_body_attrs(
self, display_name=None,
admin_state=True, tags=[],
address_bindings=[],
switch_profile_ids=[]):
admin_state=True, tags=None,
address_bindings=None,
switch_profile_ids=None):
tags = tags or []
address_bindings = address_bindings or []
switch_profile_ids = switch_profile_ids or []
body = {}
if tags:
body['tags'] = tags
@ -207,11 +209,12 @@ class LogicalPort(AbstractRESTResource):
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,
admin_state=True, name=None, address_bindings=None,
parent_name=None, parent_tag=None,
switch_profile_ids=None):
tags = tags or []
# NOTE(arosen): if a parent_name is specified we need to use the
# CIF's attachment.

View File

@ -1519,7 +1519,8 @@ def clear_gateway(nsxv_manager, context, router_id):
def update_external_interface(
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)
net_bindings = nsxv_db.get_network_bindings(context.session, ext_net_id)
if not net_bindings: