summaryrefslogtreecommitdiff
path: root/cloudinit/transforms/cc_rsyslog.py
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2012-06-15 21:33:55 -0700
committerJoshua Harlow <harlowja@yahoo-inc.com>2012-06-15 21:33:55 -0700
commit450261a1fcf1f8929a2f7a25c2c278ba40689289 (patch)
tree83430d74ea63c5a11df3fb774e281d0f8efce8f3 /cloudinit/transforms/cc_rsyslog.py
parent784edb7689d60b81a4334d5171603841cc83da98 (diff)
downloadvyos-cloud-init-450261a1fcf1f8929a2f7a25c2c278ba40689289.tar.gz
vyos-cloud-init-450261a1fcf1f8929a2f7a25c2c278ba40689289.zip
Fixups to ensure that pylint does not find anything major wrong.
Diffstat (limited to 'cloudinit/transforms/cc_rsyslog.py')
-rw-r--r--cloudinit/transforms/cc_rsyslog.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/cloudinit/transforms/cc_rsyslog.py b/cloudinit/transforms/cc_rsyslog.py
index ccbe68ff..71b74711 100644
--- a/cloudinit/transforms/cc_rsyslog.py
+++ b/cloudinit/transforms/cc_rsyslog.py
@@ -36,7 +36,8 @@ def handle(name, cfg, cloud, log, _args):
# process 'rsyslog'
if not 'rsyslog' in cfg:
- log.debug("Skipping module named %s, no 'rsyslog' key in configuration", name)
+ log.debug(("Skipping transform named %s,"
+ " no 'rsyslog' key in configuration"), name)
return
def_dir = cfg.get('rsyslog_dir', DEF_DIR)
@@ -62,15 +63,16 @@ def handle(name, cfg, cloud, log, _args):
if not filename.startswith("/"):
filename = os.path.join(def_dir, filename)
+ # Truncate filename first time you see it
omode = "ab"
- # truncate filename first time you see it
if filename not in files:
omode = "wb"
files.append(filename)
try:
- util.write_file(filename, content + "\n", omode=omode)
- except Exception as e:
+ contents = "%s\n" % (content)
+ util.write_file(filename, contents, omode=omode)
+ except Exception:
util.logexc(log, "Failed to write to %s", filename)
# Attempt to restart syslogd
@@ -87,8 +89,8 @@ def handle(name, cfg, cloud, log, _args):
log.debug("Restarting rsyslog")
util.subp(['service', 'rsyslog', 'restart'])
restarted = True
- except Exception as e:
- util.logexc("Failed restarting rsyslog")
+ except Exception:
+ util.logexc(log, "Failed restarting rsyslog")
if restarted:
# This only needs to run if we *actually* restarted