diff options
author | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-11-07 10:42:54 -0500 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2012-11-07 10:42:54 -0500 |
commit | 21a3cf3186809f9dae387e52e8bd9bc548981003 (patch) | |
tree | d82d3c05e0f295ad2dda2dee5d0ca5b6ab116b78 /cloudinit/distros/__init__.py | |
parent | e6d4b76e5e60ff558c247ad76acd27343afe367c (diff) | |
parent | 8b677bc80a39a0eb1a3cc7989c6bffb959fc7a69 (diff) | |
download | vyos-cloud-init-21a3cf3186809f9dae387e52e8bd9bc548981003.tar.gz vyos-cloud-init-21a3cf3186809f9dae387e52e8bd9bc548981003.zip |
test and path cleanups.
1. Remove the usage of the path.join function now that all code should
be going through the util file methods (and they can be mocked out as
needed).
2. Adjust all occurences of the above join function to either not use it
or replace it with the standard os.path.join (which can also be mocked
out as needed)
3. Fix pylint from complaining about the tests folder 'helpers.py' not
being found.
4. Add a pylintrc file that is used instead of the options hidden in the
'run_pylint' tool.
Diffstat (limited to 'cloudinit/distros/__init__.py')
-rw-r--r-- | cloudinit/distros/__init__.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py index 2fbb0e9b..869540d2 100644 --- a/cloudinit/distros/__init__.py +++ b/cloudinit/distros/__init__.py @@ -122,8 +122,7 @@ class Distro(object): new_etchosts = StringIO() need_write = False need_change = True - hosts_ro_fn = self._paths.join(True, "/etc/hosts") - for line in util.load_file(hosts_ro_fn).splitlines(): + for line in util.load_file("/etc/hosts").splitlines(): if line.strip().startswith(header): continue if not line.strip() or line.strip().startswith("#"): @@ -147,8 +146,7 @@ class Distro(object): need_write = True if need_write: contents = new_etchosts.getvalue() - util.write_file(self._paths.join(False, "/etc/hosts"), - contents, mode=0644) + util.write_file("/etc/hosts", contents, mode=0644) def _bring_up_interface(self, device_name): cmd = ['ifup', device_name] @@ -262,7 +260,7 @@ class Distro(object): # Import SSH keys if 'ssh_authorized_keys' in kwargs: keys = set(kwargs['ssh_authorized_keys']) or [] - ssh_util.setup_user_keys(keys, name, None, self._paths) + ssh_util.setup_user_keys(keys, name, key_prefix=None) return True |