summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2012-11-12 22:14:31 -0800
committerJoshua Harlow <harlowja@yahoo-inc.com>2012-11-12 22:14:31 -0800
commitc8c2ff830f917a7ddecab21eeecb99a20c2e9805 (patch)
treed3ed7a7862d3c560aaf3c29f7c3f955ce4e46a70
parentd5aeda9535ab530fd2c09e6ad37443c9013c3b4d (diff)
downloadvyos-cloud-init-c8c2ff830f917a7ddecab21eeecb99a20c2e9805.tar.gz
vyos-cloud-init-c8c2ff830f917a7ddecab21eeecb99a20c2e9805.zip
Pylint and pep8 cleanups.
-rw-r--r--cloudinit/distros/parsers/hosts.py1
-rw-r--r--cloudinit/distros/rhel.py10
-rw-r--r--tests/unittests/test_distros/test_sysconfig.py1
3 files changed, 5 insertions, 7 deletions
diff --git a/cloudinit/distros/parsers/hosts.py b/cloudinit/distros/parsers/hosts.py
index 958a7c31..94c97051 100644
--- a/cloudinit/distros/parsers/hosts.py
+++ b/cloudinit/distros/parsers/hosts.py
@@ -90,4 +90,3 @@ class HostsConf(object):
pieces = "\t".join(pieces)
contents.write("%s%s\n" % (pieces, tail))
return contents.getvalue()
-
diff --git a/cloudinit/distros/rhel.py b/cloudinit/distros/rhel.py
index 7df01c62..bc0877d5 100644
--- a/cloudinit/distros/rhel.py
+++ b/cloudinit/distros/rhel.py
@@ -48,7 +48,7 @@ class Distro(distros.Distro):
clock_conf_fn = "/etc/sysconfig/clock"
locale_conf_fn = '/etc/sysconfig/i18n'
network_conf_fn = "/etc/sysconfig/network"
- hostname_conf_fn = "/etc/sysconfig/network"
+ hostname_conf_fn = "/etc/sysconfig/network"
network_script_tpl = '/etc/sysconfig/network-scripts/ifcfg-%s'
resolve_conf_fn = "/etc/resolv.conf"
tz_local_fn = "/etc/localtime"
@@ -65,11 +65,11 @@ class Distro(distros.Distro):
self.package_command('install', pkglist)
def _adjust_resolve(self, dns_servers, search_servers):
- r_conf = ResolvConf(util.load_file(self.resolve_conf_fn))
try:
+ r_conf = ResolvConf(util.load_file(self.resolve_conf_fn))
r_conf.parse()
except IOError:
- util.logexc(LOG,
+ util.logexc(LOG,
"Failed at parsing %s reverting to an empty instance",
self.resolve_conf_fn)
r_conf = ResolvConf('')
@@ -178,10 +178,10 @@ class Distro(distros.Distro):
def _read_conf(self, fn):
exists = False
- if os.path.isfile(fn):
+ try:
contents = util.load_file(fn).splitlines()
exists = True
- else:
+ except IOError:
contents = []
return (exists,
SysConf(contents))
diff --git a/tests/unittests/test_distros/test_sysconfig.py b/tests/unittests/test_distros/test_sysconfig.py
index 1e34909d..0c651407 100644
--- a/tests/unittests/test_distros/test_sysconfig.py
+++ b/tests/unittests/test_distros/test_sysconfig.py
@@ -80,4 +80,3 @@ USEMD5=no'''
contents = str(conf)
self.assertIn("Z=d", contents)
self.assertIn("BLAH=b", contents)
-