diff options
Diffstat (limited to 'cloudinit/distros')
-rw-r--r-- | cloudinit/distros/rhel.py | 6 | ||||
-rw-r--r-- | cloudinit/distros/ubuntu.py | 7 |
2 files changed, 10 insertions, 3 deletions
diff --git a/cloudinit/distros/rhel.py b/cloudinit/distros/rhel.py index e0ca5909..aef7f6f3 100644 --- a/cloudinit/distros/rhel.py +++ b/cloudinit/distros/rhel.py @@ -73,6 +73,7 @@ class Distro(distros.Distro): lines.insert(0, '# Created by cloud-init') contents = "\n".join(lines) net_fn = NETWORK_FN_TPL % (dev) + net_fn = self._paths.join(False, net_fn) util.write_file(net_fn, contents, 0644) def set_hostname(self, hostname): @@ -104,6 +105,7 @@ class Distro(distros.Distro): new_contents.append("# Added by cloud-init") new_contents.append("HOSTNAME=%s" % (hostname)) contents = "\n".join(new_contents) + out_fn = self._paths.join(False, out_fn) util.write_file(out_fn, contents, 0644) def update_hostname(self, hostname, prev_file): @@ -143,6 +145,7 @@ class Distro(distros.Distro): return default def _read_conf(self, filename): + filename = self._paths.join(True, filename) contents = util.load_file(filename, quiet=True) conf_lines = [] for line in contents.splitlines(): @@ -194,7 +197,8 @@ class Distro(distros.Distro): new_contents.append("# Added by cloud-init") new_contents.append('ZONE="%s"' % (tz)) tz_contents = "\n".join(new_contents) - util.write_file("/etc/sysconfig/clock", tz_contents) + tz_fn = self._paths.join(False, "/etc/sysconfig/clock") + util.write_file(tz_fn, tz_contents) # This ensures that the correct tz will be used for the system util.copy(tz_file, "/etc/localtime") 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): |