Merge branch 'master' into notifications

Took the __file parts from master.

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

Conflicts:
	cdist/conf/type/__file/gencode-local
	cdist/conf/type/__file/gencode-remote
This commit is contained in:
Nico Schottelius 2013-12-03 14:38:11 +01:00
commit 684ad56a80
21 changed files with 401 additions and 190 deletions

View file

@ -196,8 +196,13 @@ class Local(object):
def save_cache(self):
destination = os.path.join(self.cache_path, self.target_host)
self.log.debug("Saving " + self.base_path + " to " + destination)
if os.path.exists(destination):
shutil.rmtree(destination)
try:
if os.path.exists(destination):
shutil.rmtree(destination)
except PermissionError as e:
raise cdist.Error("Cannot delete old cache %s: %s" % (destination, e))
shutil.move(self.base_path, destination)
def _create_messages(self):