summaryrefslogtreecommitdiff
path: root/cloudinit/config/cc_apt_pipelining.py
diff options
context:
space:
mode:
authorharlowja <harlowja@virtualbox.rhel>2012-10-27 19:25:48 -0700
committerharlowja <harlowja@virtualbox.rhel>2012-10-27 19:25:48 -0700
commitaa8b51a48a30e3a3c863ca0ddb8bc4667026d57a (patch)
tree664d7bfb27d2394a02b9a3aeb4f25b8a835f6be5 /cloudinit/config/cc_apt_pipelining.py
parent71b4108d029fff61ff8183ffbd77917569bea2cd (diff)
downloadvyos-cloud-init-aa8b51a48a30e3a3c863ca0ddb8bc4667026d57a.tar.gz
vyos-cloud-init-aa8b51a48a30e3a3c863ca0ddb8bc4667026d57a.zip
Helpful 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/config/cc_apt_pipelining.py')
-rw-r--r--cloudinit/config/cc_apt_pipelining.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/cloudinit/config/cc_apt_pipelining.py b/cloudinit/config/cc_apt_pipelining.py
index 02056ee0..e5629175 100644
--- a/cloudinit/config/cc_apt_pipelining.py
+++ b/cloudinit/config/cc_apt_pipelining.py
@@ -34,26 +34,24 @@ APT_PIPE_TPL = ("//Written by cloud-init per 'apt_pipelining'\n"
# on TCP connections - otherwise data corruption will occur.
-def handle(_name, cfg, cloud, log, _args):
+def handle(_name, cfg, _cloud, log, _args):
apt_pipe_value = util.get_cfg_option_str(cfg, "apt_pipelining", False)
apt_pipe_value_s = str(apt_pipe_value).lower().strip()
if apt_pipe_value_s == "false":
- write_apt_snippet(cloud, "0", log, DEFAULT_FILE)
+ write_apt_snippet("0", log, DEFAULT_FILE)
elif apt_pipe_value_s in ("none", "unchanged", "os"):
return
elif apt_pipe_value_s in [str(b) for b in xrange(0, 6)]:
- write_apt_snippet(cloud, apt_pipe_value_s, log, DEFAULT_FILE)
+ write_apt_snippet(apt_pipe_value_s, log, DEFAULT_FILE)
else:
log.warn("Invalid option for apt_pipeling: %s", apt_pipe_value)
-def write_apt_snippet(cloud, setting, log, f_name):
+def write_apt_snippet(setting, log, f_name):
"""Writes f_name with apt pipeline depth 'setting'."""
file_contents = APT_PIPE_TPL % (setting)
-
- util.write_file(cloud.paths.join(False, f_name), file_contents)
-
+ util.write_file(f_name, file_contents)
log.debug("Wrote %s with apt pipeline depth setting %s", f_name, setting)