summaryrefslogtreecommitdiff
path: root/cloudinit/helpers.py
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2012-11-07 10:42:54 -0500
committerScott Moser <smoser@ubuntu.com>2012-11-07 10:42:54 -0500
commit21a3cf3186809f9dae387e52e8bd9bc548981003 (patch)
treed82d3c05e0f295ad2dda2dee5d0ca5b6ab116b78 /cloudinit/helpers.py
parente6d4b76e5e60ff558c247ad76acd27343afe367c (diff)
parent8b677bc80a39a0eb1a3cc7989c6bffb959fc7a69 (diff)
downloadvyos-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/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