summaryrefslogtreecommitdiff
path: root/cloudinit/distros/ubuntu.py
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2012-06-19 17:58:41 -0700
committerJoshua Harlow <harlowja@yahoo-inc.com>2012-06-19 17:58:41 -0700
commit43eb6d5aace53bef2116dde0796807befef1d8ff (patch)
tree4e19b985cb97fd1293f9617c2b800e5377fc8494 /cloudinit/distros/ubuntu.py
parentb492cedaa5a4e66f4f4c589fc73f53afade7b904 (diff)
downloadvyos-cloud-init-43eb6d5aace53bef2116dde0796807befef1d8ff.tar.gz
vyos-cloud-init-43eb6d5aace53bef2116dde0796807befef1d8ff.zip
Make most of all the places use the paths join() function so that testing with non-real read/write paths is easier.
Diffstat (limited to 'cloudinit/distros/ubuntu.py')
-rw-r--r--cloudinit/distros/ubuntu.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/cloudinit/distros/ubuntu.py b/cloudinit/distros/ubuntu.py
index 24724d83..94565b14 100644
--- a/cloudinit/distros/ubuntu.py
+++ b/cloudinit/distros/ubuntu.py
@@ -46,7 +46,8 @@ class Distro(distros.Distro):
self.package_command('install', pkglist)
def _write_network(self, settings):
- util.write_file("/etc/network/interfaces", settings)
+ n_fn = self._paths.join(False, "/etc/network/interfaces")
+ util.write_file(n_fn, settings)
def set_hostname(self, hostname):
self._write_hostname(hostname, "/etc/hostname")
@@ -84,6 +85,7 @@ class Distro(distros.Distro):
util.subp(['hostname', hostname])
def _read_hostname(self, filename, default=None):
+ filename = self._paths.join(True, filename)
contents = util.load_file(filename, quiet=True)
for line in contents.splitlines():
c_pos = line.find("#")
@@ -105,7 +107,8 @@ class Distro(distros.Distro):
raise Exception(("Invalid timezone %s,"
" no file found at %s") % (tz, tz_file))
tz_contents = "%s\n" % tz
- util.write_file("/etc/timezone", tz_contents)
+ tz_fn = self._paths.join(False, "/etc/timezone")
+ util.write_file(tz_fn, tz_contents)
util.copy(tz_file, "/etc/localtime")
def package_command(self, command, args=None):