From 744679601fa3612c4700ee4c52486ba512d10eff Mon Sep 17 00:00:00 2001 From: gduke Date: Tue, 20 Oct 2015 22:13:23 -0700 Subject: [PATCH] Remove mutable default arguments. --- lib/ansible/module_utils/cloudstack.py | 4 +++- lib/ansible/module_utils/urls.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/ansible/module_utils/cloudstack.py b/lib/ansible/module_utils/cloudstack.py index d20b750f7e..549f6afcba 100644 --- a/lib/ansible/module_utils/cloudstack.py +++ b/lib/ansible/module_utils/cloudstack.py @@ -150,7 +150,9 @@ class AnsibleCloudStack(object): return False - def _get_by_key(self, key=None, my_dict={}): + def _get_by_key(self, key=None, my_dict=None): + if my_dict is None: + my_dict = {} if key: if key in my_dict: return my_dict[key] diff --git a/lib/ansible/module_utils/urls.py b/lib/ansible/module_utils/urls.py index 5fa5f08183..f68f8133cc 100644 --- a/lib/ansible/module_utils/urls.py +++ b/lib/ansible/module_utils/urls.py @@ -400,7 +400,9 @@ class RequestWithMethod(urllib2.Request): Originally contained in library/net_infrastructure/dnsmadeeasy ''' - def __init__(self, url, method, data=None, headers={}): + def __init__(self, url, method, data=None, headers=None): + if headers is None: + headers = {} self._method = method urllib2.Request.__init__(self, url, data, headers)