summaryrefslogtreecommitdiff
path: root/cloudinit/DataSource.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/DataSource.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/DataSource.py')
-rw-r--r--cloudinit/DataSource.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/cloudinit/DataSource.py b/cloudinit/DataSource.py
index ac79f757..7e539b67 100644
--- a/cloudinit/DataSource.py
+++ b/cloudinit/DataSource.py
@@ -35,7 +35,7 @@ class DataSource:
# datasource config, the cloud-config['datasource']['__name__']
ds_cfg = { } # datasource config
- def __init__(self,sys_cfg=None):
+ def __init__(self, sys_cfg=None):
if not self.cfgname:
name = str(self.__class__).split(".")[-1]
if name.startswith("DataSource"):
@@ -45,7 +45,7 @@ class DataSource:
self.sys_cfg = sys_cfg
self.ds_cfg = util.get_cfg_by_path(self.sys_cfg,
- ("datasource",self.cfgname),self.ds_cfg)
+ ("datasource", self.cfgname), self.ds_cfg)
def get_userdata(self):
if self.userdata == None:
@@ -64,7 +64,8 @@ class DataSource:
def get_public_ssh_keys(self):
keys = []
- if not self.metadata.has_key('public-keys'): return([])
+ if not self.metadata.has_key('public-keys'):
+ return([])
if isinstance(self.metadata['public-keys'], str):
return([self.metadata['public-keys'],])
@@ -73,7 +74,7 @@ class DataSource:
# lp:506332 uec metadata service responds with
# data that makes boto populate a string for 'klist' rather
# than a list.
- if isinstance(klist,str):
+ if isinstance(klist, str):
klist = [ klist ]
for pkey in klist:
# there is an empty string at the end of the keylist, trim it
@@ -131,7 +132,7 @@ class DataSource:
# make up a hostname (LP: #475354) in format ip-xx.xx.xx.xx
lhost = self.metadata['local-hostname']
if is_ipv4(lhost):
- toks = "ip-%s" % lhost.replace(".","-")
+ toks = "ip-%s" % lhost.replace(".", "-")
else:
toks = lhost.split(".")
@@ -142,7 +143,7 @@ class DataSource:
hostname = toks[0]
if fqdn:
- return "%s.%s" % (hostname,domain)
+ return "%s.%s" % (hostname, domain)
else:
return hostname
@@ -163,7 +164,8 @@ def list_sources(cfg_list, depends, pkglist=None):
retlist = []
for ds_coll in cfg_list:
for pkg in pkglist:
- if pkg: pkg="%s." % pkg
+ if pkg:
+ pkg = "%s." % pkg
try:
mod = __import__("%sDataSource%s" % (pkg, ds_coll))
if pkg: