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
|
||||
#
|
||||
# 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
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue