diff options
author | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-06-19 18:30:28 -0700 |
---|---|---|
committer | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-06-19 18:30:28 -0700 |
commit | 39e3649f0cd863ffcb82b1ea83c147272b1784a2 (patch) | |
tree | 283ce688f6eada0e34a8bdda3a9c2b57e537c954 /cloudinit/distros/__init__.py | |
parent | 319412b9fac28ae0a0ae059f44e668bc7d3bf857 (diff) | |
download | vyos-cloud-init-39e3649f0cd863ffcb82b1ea83c147272b1784a2.tar.gz vyos-cloud-init-39e3649f0cd863ffcb82b1ea83c147272b1784a2.zip |
More cleanups around read/write roots
Diffstat (limited to 'cloudinit/distros/__init__.py')
-rw-r--r-- | cloudinit/distros/__init__.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py index 483642f3..6a98fdb1 100644 --- a/cloudinit/distros/__init__.py +++ b/cloudinit/distros/__init__.py @@ -100,7 +100,8 @@ class Distro(object): new_etchosts = StringIO() need_write = False need_change = True - for line in util.load_file("/etc/hosts").splitlines(): + hosts_ro_fn = self._paths.join(True, "/etc/hosts") + for line in util.load_file(hosts_ro_fn).splitlines(): if line.strip().startswith(header): continue if not line.strip() or line.strip().startswith("#"): @@ -124,7 +125,8 @@ class Distro(object): need_write = True if need_write: contents = new_etchosts.getvalue() - util.write_file("/etc/hosts", contents, mode=0644) + util.write_file(self._paths.join(False, "/etc/hosts"), + contents, mode=0644) def _interface_action(self, action): if action not in IFACE_ACTIONS: |