From 5e51d844015160a63c1b4aa5afd39fc0701ed71f Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Sat, 16 Jun 2012 08:53:51 -0700 Subject: Have the contents formed on a previous line which seems prettier. --- cloudinit/distros/ubuntu.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'cloudinit/distros/ubuntu.py') diff --git a/cloudinit/distros/ubuntu.py b/cloudinit/distros/ubuntu.py index 9252a1c4..ad12400a 100644 --- a/cloudinit/distros/ubuntu.py +++ b/cloudinit/distros/ubuntu.py @@ -44,7 +44,8 @@ class Distro(distros.Distro): self._apt_get(command, args) def set_hostname(self, hostname): - util.write_file("/etc/hostname", "%s\n" % hostname, 0644) + contents = "%s\n" % (hostname) + util.write_file("/etc/hostname", contents, 0644) LOG.debug("Setting hostname to %s", hostname) util.subp(['hostname', hostname]) @@ -59,7 +60,8 @@ class Distro(distros.Distro): update_files.append("/etc/hostname") for fn in update_files: try: - util.write_file(fn, "%s\n" % hostname, 0644) + contents = "%s\n" % (hostname) + util.write_file(fn, contents, 0644) except: util.logexc(LOG, "Failed to write hostname %s to %s", hostname, fn) -- cgit v1.2.3