Merge branch 'enhance_cache'

Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>

Conflicts:
	cdist/test/code/__init__.py
	cdist/test/config_install/__init__.py
	cdist/test/explorer/__init__.py
This commit is contained in:
Nico Schottelius 2013-08-28 15:43:03 +02:00
commit e6feee14fb
12 changed files with 87 additions and 67 deletions

View file

@ -43,12 +43,20 @@ class Remote(object):
Directly accessing the remote side from python code is a bug.
"""
def __init__(self, target_host, remote_exec, remote_copy):
def __init__(self,
target_host,
remote_exec,
remote_copy,
base_path=None):
self.target_host = target_host
self.base_path = os.environ.get('__cdist_remote_out_dir', "/var/lib/cdist")
self._exec = remote_exec
self._copy = remote_copy
if base_path:
self.base_path = base_path
else:
self.base_path = "/var/lib/cdist"
self.conf_path = os.path.join(self.base_path, "conf")
self.object_path = os.path.join(self.base_path, "object")
@ -141,6 +149,6 @@ class Remote(object):
except subprocess.CalledProcessError:
raise cdist.Error("Command failed: " + " ".join(command))
except OSError as error:
raise cdist.Error(" ".join(*args) + ": " + error.args[1])
raise cdist.Error(" ".join(command) + ": " + error.args[1])
except UnicodeDecodeError:
raise DecodeError(command)