diff options
author | Mike Milner <mike.milner@canonical.com> | 2012-01-17 13:39:37 -0400 |
---|---|---|
committer | Mike Milner <mike.milner@canonical.com> | 2012-01-17 13:39:37 -0400 |
commit | 69d6195ec6a37dc7a8f045fc262c74d01624eb56 (patch) | |
tree | 303ed83b05fdac41604ff3ad7c83c8c8046462eb /cloudinit/DataSource.py | |
parent | f52ffe2dda01dd0314523fcac559e6f3fbb3578e (diff) | |
parent | 1d00c0936bfc63117493d89268da8c81611b3c40 (diff) | |
download | vyos-cloud-init-69d6195ec6a37dc7a8f045fc262c74d01624eb56.tar.gz vyos-cloud-init-69d6195ec6a37dc7a8f045fc262c74d01624eb56.zip |
Merge from trunk.
Diffstat (limited to 'cloudinit/DataSource.py')
-rw-r--r-- | cloudinit/DataSource.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/cloudinit/DataSource.py b/cloudinit/DataSource.py index 06061a2e..ac79f757 100644 --- a/cloudinit/DataSource.py +++ b/cloudinit/DataSource.py @@ -69,7 +69,7 @@ class DataSource: if isinstance(self.metadata['public-keys'], str): return([self.metadata['public-keys'],]) - for keyname, klist in self.metadata['public-keys'].items(): + for _keyname, klist in self.metadata['public-keys'].items(): # lp:506332 uec metadata service responds with # data that makes boto populate a string for 'klist' rather # than a list. @@ -82,7 +82,7 @@ class DataSource: return(keys) - def device_name_to_device(self, name): + def device_name_to_device(self, _name): # translate a 'name' to a device # the primary function at this point is on ec2 # to consult metadata service, that has @@ -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: @@ -197,8 +199,8 @@ def is_ipv4(instr): return False try: - r = filter(lambda x: int(x) < 256 and x > 0, toks) + toks = [x for x in toks if (int(x) < 256 and int(x) > 0)] except: return False - return True + return (len(toks) == 4) |