summaryrefslogtreecommitdiff
path: root/cloudinit/helpers.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/helpers.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/helpers.py')
-rw-r--r--cloudinit/helpers.py29
1 files changed, 1 insertions, 28 deletions
diff --git a/cloudinit/helpers.py b/cloudinit/helpers.py
index a4b20208..985ce3e5 100644
--- a/cloudinit/helpers.py
+++ b/cloudinit/helpers.py
@@ -302,14 +302,10 @@ class Paths(object):
def __init__(self, path_cfgs, ds=None):
self.cfgs = path_cfgs
# Populate all the initial paths
- self.cloud_dir = self.join(False,
- path_cfgs.get('cloud_dir',
- '/var/lib/cloud'))
+ self.cloud_dir = path_cfgs.get('cloud_dir', '/var/lib/cloud')
self.instance_link = os.path.join(self.cloud_dir, 'instance')
self.boot_finished = os.path.join(self.instance_link, "boot-finished")
self.upstart_conf_d = path_cfgs.get('upstart_dir')
- if self.upstart_conf_d:
- self.upstart_conf_d = self.join(False, self.upstart_conf_d)
self.seed_dir = os.path.join(self.cloud_dir, 'seed')
# This one isn't joined, since it should just be read-only
template_dir = path_cfgs.get('templates_dir', '/etc/cloud/templates/')
@@ -328,29 +324,6 @@ class Paths(object):
# Set when a datasource becomes active
self.datasource = ds
- # joins the paths but also appends a read
- # or write root if available
- def join(self, read_only, *paths):
- if read_only:
- root = self.cfgs.get('read_root')
- else:
- root = self.cfgs.get('write_root')
- if not paths:
- return root
- if len(paths) > 1:
- joined = os.path.join(*paths)
- else:
- joined = paths[0]
- if root:
- pre_joined = joined
- # Need to remove any starting '/' since this
- # will confuse os.path.join
- joined = joined.lstrip("/")
- joined = os.path.join(root, joined)
- LOG.debug("Translated %s to adjusted path %s (read-only=%s)",
- pre_joined, joined, read_only)
- return joined
-
# get_ipath_cur: get the current instance path for an item
def get_ipath_cur(self, name=None):
ipath = self.instance_link