summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2012-06-16 08:53:51 -0700
committerJoshua Harlow <harlowja@yahoo-inc.com>2012-06-16 08:53:51 -0700
commit5e51d844015160a63c1b4aa5afd39fc0701ed71f (patch)
tree740987c32c8cbdaea56b83abc2be03104e7797a7 /cloudinit
parent86fb18047eeddb5c4d3950ffaa6927ddfba90565 (diff)
downloadvyos-cloud-init-5e51d844015160a63c1b4aa5afd39fc0701ed71f.tar.gz
vyos-cloud-init-5e51d844015160a63c1b4aa5afd39fc0701ed71f.zip
Have the contents formed on a previous line which seems prettier.
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/distros/ubuntu.py6
1 files changed, 4 insertions, 2 deletions
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)