fix cache_dir syntax error

Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
This commit is contained in:
Nico Schottelius 2012-10-30 16:11:03 +01:00
parent dcaa70e6be
commit e41aae041a
2 changed files with 8 additions and 7 deletions

View file

@ -59,7 +59,7 @@ class Context(object):
self.temp_dir = tempfile.mkdtemp() self.temp_dir = tempfile.mkdtemp()
self.out_path = os.path.join(self.temp_dir, "out") self.out_path = os.path.join(self.temp_dir, "out")
self.local = local.Local(self.target_host, self.conf_dirs, self.out_path) self.local = local.Local(self.target_host, conf_dirs, self.out_path)
self.initial_manifest = (initial_manifest or self.initial_manifest = (initial_manifest or
os.path.join(self.local.manifest_path, "init")) os.path.join(self.local.manifest_path, "init"))

View file

@ -37,7 +37,7 @@ class Local(object):
Directly accessing the local side from python code is a bug. Directly accessing the local side from python code is a bug.
""" """
def __init__(self, target_host, conf_dirs, out_path, cache_dir): def __init__(self, target_host, conf_dirs, out_path, cache_dir=None):
self.target_host = target_host self.target_host = target_host
self.add_conf_dirs = conf_dirs self.add_conf_dirs = conf_dirs
@ -47,7 +47,7 @@ class Local(object):
self._init_permissions() self._init_permissions()
self._init_home_dir() self._init_home_dir()
self._init_paths() self._init_paths()
self._init_cache_dir() self._init_cache_dir(cache_dir)
self._init_conf_dirs() self._init_conf_dirs()
def _init_home_dir(self): def _init_home_dir(self):
@ -88,6 +88,7 @@ class Local(object):
self.conf_dirs.append(user_conf_dir) self.conf_dirs.append(user_conf_dir)
# Add user supplied directories # Add user supplied directories
if self.add_conf_dirs:
self.conf_dirs.extend(self.add_conf_dirs) self.conf_dirs.extend(self.add_conf_dirs)
def _init_cache_dir(self, cache_dir): def _init_cache_dir(self, cache_dir):
@ -166,12 +167,12 @@ class Local(object):
for entry in os.listdir(current_dir): for entry in os.listdir(current_dir):
rel_entry_path = os.path.join(sub_dir, entry) rel_entry_path = os.path.join(sub_dir, entry)
src = os.path.join(self.conf_path, entry) src = os.path.join(conf_dir, sub_dir, entry)
dst = os.path.join(conf_dir, sub_dir, entry) dst = os.path.join(self.conf_path, entry)
# Already exists? remove and link # Already exists? remove and link
if os.path.exists(dst): if os.path.exists(dst):
os.ulink(dst) os.unlink(dst)
try: try:
os.symlink(src, dst) os.symlink(src, dst)