summaryrefslogtreecommitdiff
path: root/cloudinit/DataSourceNoCloud.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2012-01-17 12:42:44 -0500
committerScott Moser <smoser@ubuntu.com>2012-01-17 12:42:44 -0500
commit2f7227c7092ad873757167f62c2a82fb4ee69472 (patch)
treeacc620e1f0423910a4d0ea0d79ee231290e4a393 /cloudinit/DataSourceNoCloud.py
parent1d00c0936bfc63117493d89268da8c81611b3c40 (diff)
parentec070cdf8746651d6dea011bd3ea9a445223028c (diff)
downloadvyos-cloud-init-2f7227c7092ad873757167f62c2a82fb4ee69472.tar.gz
vyos-cloud-init-2f7227c7092ad873757167f62c2a82fb4ee69472.zip
fix pylint warnings (LP: #914739) [Juerg Haefliger]
This merge pulls in Jeurg's 'fix-pylint-warnings.tgz' patchset from LP: #914739.
Diffstat (limited to 'cloudinit/DataSourceNoCloud.py')
-rw-r--r--cloudinit/DataSourceNoCloud.py40
1 files changed, 21 insertions, 19 deletions
diff --git a/cloudinit/DataSourceNoCloud.py b/cloudinit/DataSourceNoCloud.py
index 2f4bd604..d63cdc95 100644
--- a/cloudinit/DataSourceNoCloud.py
+++ b/cloudinit/DataSourceNoCloud.py
@@ -31,7 +31,7 @@ class DataSourceNoCloud(DataSource.DataSource):
seeddir = seeddir + '/nocloud'
def __str__(self):
- mstr="DataSourceNoCloud"
+ mstr = "DataSourceNoCloud"
mstr = mstr + " [seed=%s]" % self.seed
return(mstr)
@@ -53,9 +53,9 @@ class DataSourceNoCloud(DataSource.DataSource):
return False
# check to see if the seeddir has data.
- seedret={ }
- if util.read_optional_seed(seedret,base=self.seeddir + "/"):
- md = util.mergedict(md,seedret['meta-data'])
+ seedret = { }
+ if util.read_optional_seed(seedret, base=self.seeddir + "/"):
+ md = util.mergedict(md, seedret['meta-data'])
ud = seedret['user-data']
found.append(self.seeddir)
log.debug("using seeded cache data in %s" % self.seeddir)
@@ -72,7 +72,7 @@ class DataSourceNoCloud(DataSource.DataSource):
seedfound = False
for proto in self.supported_seed_starts:
if seedfrom.startswith(proto):
- seedfound=proto
+ seedfound = proto
break
if not seedfound:
log.debug("seed from %s not supported by %s" %
@@ -81,14 +81,14 @@ class DataSourceNoCloud(DataSource.DataSource):
# this could throw errors, but the user told us to do it
# so if errors are raised, let them raise
- (md_seed,ud) = util.read_seeded(seedfrom, timeout=None)
+ (md_seed, ud) = util.read_seeded(seedfrom, timeout=None)
log.debug("using seeded cache data from %s" % seedfrom)
# values in the command line override those from the seed
- md = util.mergedict(md,md_seed)
+ md = util.mergedict(md, md_seed)
found.append(seedfrom)
- md = util.mergedict(md,defaults)
+ md = util.mergedict(md, defaults)
self.seed = ",".join(found)
self.metadata = md
self.userdata_raw = ud
@@ -98,7 +98,7 @@ class DataSourceNoCloud(DataSource.DataSource):
# that this module should be used
# example cmdline:
# root=LABEL=uec-rootfs ro ds=nocloud
-def parse_cmdline_data(ds_id,fill,cmdline=None):
+def parse_cmdline_data(ds_id, fill, cmdline=None):
if cmdline is None:
cmdline = util.get_cmdline()
cmdline = " %s " % cmdline
@@ -106,30 +106,32 @@ def parse_cmdline_data(ds_id,fill,cmdline=None):
if not ( " %s " % ds_id in cmdline or " %s;" % ds_id in cmdline ):
return False
- argline=""
+ argline = ""
# cmdline can contain:
# ds=nocloud[;key=val;key=val]
for tok in cmdline.split():
- if tok.startswith(ds_id): argline=tok.split("=",1)
+ if tok.startswith(ds_id):
+ argline = tok.split("=", 1)
# argline array is now 'nocloud' followed optionally by
# a ';' and then key=value pairs also terminated with ';'
- tmp=argline[1].split(";")
+ tmp = argline[1].split(";")
if len(tmp) > 1:
- kvpairs=tmp[1:]
+ kvpairs = tmp[1:]
else:
- kvpairs=()
+ kvpairs = ()
# short2long mapping to save cmdline typing
s2l = { "h" : "local-hostname", "i" : "instance-id", "s" : "seedfrom" }
for item in kvpairs:
try:
- (k,v) = item.split("=",1)
+ (k, v) = item.split("=", 1)
except:
- k=item
- v=None
- if k in s2l: k=s2l[k]
- fill[k]=v
+ k = item
+ v = None
+ if k in s2l:
+ k = s2l[k]
+ fill[k] = v
return(True)