summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/CloudConfig/__init__.py6
-rw-r--r--cloudinit/CloudConfig/cc_apt_update_upgrade.py4
-rw-r--r--cloudinit/DataSource.py4
-rw-r--r--cloudinit/UserDataHandler.py4
-rw-r--r--cloudinit/__init__.py4
-rw-r--r--cloudinit/util.py4
6 files changed, 19 insertions, 7 deletions
diff --git a/cloudinit/CloudConfig/__init__.py b/cloudinit/CloudConfig/__init__.py
index 82f422fc..f5c4143c 100644
--- a/cloudinit/CloudConfig/__init__.py
+++ b/cloudinit/CloudConfig/__init__.py
@@ -33,7 +33,7 @@ class CloudConfig():
cfgfile = None
cfg = None
- def __init__(self,cfgfile, cloud=None, ds_deps=[]):
+ def __init__(self,cfgfile, cloud=None, ds_deps=None):
if cloud == None:
self.cloud = cloudinit.CloudInit(ds_deps)
self.cloud.get_data_source()
@@ -233,7 +233,9 @@ def run_per_instance(name, func, args, clear_on_fail=False):
raise
# apt_get top level command (install, update...), and args to pass it
-def apt_get(tlc,args=[]):
+def apt_get(tlc,args=None):
+ if args is None:
+ args = []
e=os.environ.copy()
e['DEBIAN_FRONTEND']='noninteractive'
cmd=[ 'apt-get',
diff --git a/cloudinit/CloudConfig/cc_apt_update_upgrade.py b/cloudinit/CloudConfig/cc_apt_update_upgrade.py
index d466f3c4..0cbe02d4 100644
--- a/cloudinit/CloudConfig/cc_apt_update_upgrade.py
+++ b/cloudinit/CloudConfig/cc_apt_update_upgrade.py
@@ -131,7 +131,9 @@ def generate_sources_list(codename, mirror):
# srclist is a list of dictionaries,
# each entry must have: 'source'
# may have: key, ( keyid and keyserver)
-def add_sources(srclist, searchList={ }):
+def add_sources(srclist, searchList=None):
+ if searchList is None:
+ searchList = {}
elst = []
for ent in srclist:
diff --git a/cloudinit/DataSource.py b/cloudinit/DataSource.py
index bdcac4ef..623f96b6 100644
--- a/cloudinit/DataSource.py
+++ b/cloudinit/DataSource.py
@@ -157,7 +157,9 @@ class DataSource:
# ie, pkglist=[ "foo", "" ]
# will first try to load foo.DataSource<item>
# then DataSource<item>
-def list_sources(cfg_list, depends, pkglist=[]):
+def list_sources(cfg_list, depends, pkglist=None):
+ if pkglist is None:
+ pkglist = []
retlist = []
for ds_coll in cfg_list:
for pkg in pkglist:
diff --git a/cloudinit/UserDataHandler.py b/cloudinit/UserDataHandler.py
index 2d257d12..14aea58b 100644
--- a/cloudinit/UserDataHandler.py
+++ b/cloudinit/UserDataHandler.py
@@ -188,7 +188,9 @@ def process_includes(msg, appendmsg=None):
_attach_part(appendmsg, part)
-def message_from_string(data, headers={}):
+def message_from_string(data, headers=None):
+ if headers is None:
+ headers = {}
if "mime-version:" in data[0:4096].lower():
msg = email.message_from_string(data)
for (key,val) in headers.items():
diff --git a/cloudinit/__init__.py b/cloudinit/__init__.py
index 0e35ab6e..72d988d5 100644
--- a/cloudinit/__init__.py
+++ b/cloudinit/__init__.py
@@ -297,7 +297,9 @@ class CloudInit:
# if that does not exist, then call 'func' with given 'args'
# if 'clear_on_fail' is True and func throws an exception
# then remove the lock (so it would run again)
- def sem_and_run(self,semname,freq,func,args=[],clear_on_fail=False):
+ def sem_and_run(self,semname,freq,func,args=None,clear_on_fail=False):
+ if args is None:
+ args = []
if self.sem_has_run(semname,freq):
log.debug("%s already ran %s", semname, freq)
return False
diff --git a/cloudinit/util.py b/cloudinit/util.py
index deb4b33b..64007211 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -238,7 +238,9 @@ def logexc(log,lvl=logging.DEBUG):
class RecursiveInclude(Exception):
pass
-def read_file_with_includes(fname, rel = ".", stack=[], patt = None):
+def read_file_with_includes(fname, rel = ".", stack=None, patt = None):
+ if stack is None:
+ stack = []
if not fname.startswith("/"):
fname = os.sep.join((rel, fname))