From c8c2ff830f917a7ddecab21eeecb99a20c2e9805 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Mon, 12 Nov 2012 22:14:31 -0800 Subject: Pylint and pep8 cleanups. --- cloudinit/distros/parsers/hosts.py | 1 - cloudinit/distros/rhel.py | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'cloudinit') 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)) -- cgit v1.2.3