forked from ungleich-public/cdist
Merge branch 'master' into preos
This commit is contained in:
commit
e58a467327
3 changed files with 10 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/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)
|
# 2013 Steven Armstrong (steven-cdist armstrong.cc)
|
||||||
#
|
#
|
||||||
# This file is part of cdist.
|
# This file is part of cdist.
|
||||||
|
@ -69,7 +69,7 @@ set_mode() {
|
||||||
|
|
||||||
case "$state_should" in
|
case "$state_should" in
|
||||||
present)
|
present)
|
||||||
if [ "$type" != "directory" ];
|
if [ "$type" != "directory" ]; then
|
||||||
# our destination is not a directory, remove whatever is there
|
# our destination is not a directory, remove whatever is there
|
||||||
# and then create our directory and set all attributes
|
# and then create our directory and set all attributes
|
||||||
set_attributes=1
|
set_attributes=1
|
||||||
|
|
|
@ -186,8 +186,13 @@ class Local(object):
|
||||||
def save_cache(self):
|
def save_cache(self):
|
||||||
destination = os.path.join(self.cache_path, self.target_host)
|
destination = os.path.join(self.cache_path, self.target_host)
|
||||||
self.log.debug("Saving " + self.base_path + " to " + destination)
|
self.log.debug("Saving " + self.base_path + " to " + destination)
|
||||||
|
|
||||||
|
try:
|
||||||
if os.path.exists(destination):
|
if os.path.exists(destination):
|
||||||
shutil.rmtree(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)
|
shutil.move(self.base_path, destination)
|
||||||
|
|
||||||
def _create_conf_path_and_link_conf_dirs(self):
|
def _create_conf_path_and_link_conf_dirs(self):
|
||||||
|
|
|
@ -9,6 +9,7 @@ Changelog
|
||||||
* Type __file: Only remove file when state is absent (Steven Armstrong)
|
* Type __file: Only remove file when state is absent (Steven Armstrong)
|
||||||
* Type __link: Only remove link 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)
|
* 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
|
2.3.6: 2013-11-25
|
||||||
* New Type: __locale
|
* New Type: __locale
|
||||||
|
|
Loading…
Reference in a new issue