diff options
Diffstat (limited to 'cloudinit/DataSource.py')
-rw-r--r-- | cloudinit/DataSource.py | 16 |
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: |