Fix dangerous default args. (#29839)

This commit is contained in:
Matt Clay 2017-09-12 00:11:13 -07:00 committed by GitHub
parent 5caa47feb9
commit 68aeaa58a8
50 changed files with 253 additions and 87 deletions

View file

@ -363,7 +363,9 @@ class LXDContainerManagement(object):
self._change_state('unfreeze')
self.actions.append('unfreez')
def _container_ipv4_addresses(self, ignore_devices=['lo']):
def _container_ipv4_addresses(self, ignore_devices=None):
ignore_devices = ['lo'] if ignore_devices is None else ignore_devices
resp_json = self._get_container_state_json()
network = resp_json['metadata']['network'] or {}
network = dict((k, v) for k, v in network.items() if k not in ignore_devices) or {}