summaryrefslogtreecommitdiff
path: root/cloudinit/distros/rhel.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/rhel.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/rhel.py')
-rw-r--r--cloudinit/distros/rhel.py6
1 files changed, 5 insertions, 1 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")