Merge branch 'master' into preos

This commit is contained in:
Nico Schottelius 2013-12-01 18:42:49 +01:00
commit e58a467327
3 changed files with 10 additions and 4 deletions

View file

@ -1,6 +1,6 @@
#!/bin/sh
#
# 2011-2012 Nico Schottelius (nico-cdist at schottelius.org)
# 2011-2013 Nico Schottelius (nico-cdist at schottelius.org)
# 2013 Steven Armstrong (steven-cdist armstrong.cc)
#
# This file is part of cdist.
@ -69,7 +69,7 @@ set_mode() {
case "$state_should" in
present)
if [ "$type" != "directory" ];
if [ "$type" != "directory" ]; then
# our destination is not a directory, remove whatever is there
# and then create our directory and set all attributes
set_attributes=1

View file

@ -186,8 +186,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_conf_path_and_link_conf_dirs(self):

View file

@ -9,6 +9,7 @@ Changelog
* Type __file: Only remove file when state is absent (Steven Armstrong)
* Type __link: Only remove link when state is absent (Steven Armstrong)
* Type __directory: Only remove directory when state is absent (Steven Armstrong)
* Core: Fix backtrace when cache cannot be deleted
2.3.6: 2013-11-25
* New Type: __locale