Commit 45c14c54 authored by Alain Takoudjou's avatar Alain Takoudjou

slapgrid: fix deleting file instead of directory with shutil

parent 6976b1d5
...@@ -1172,7 +1172,11 @@ stderr_logfile_backups=1 ...@@ -1172,7 +1172,11 @@ stderr_logfile_backups=1
file_list = os.listdir(computer_partition_path) file_list = os.listdir(computer_partition_path)
for garbage_file in [".slapgrid", ".timestamp"]: for garbage_file in [".slapgrid", ".timestamp"]:
if garbage_file in file_list: if garbage_file in file_list:
shutil.rmtree("/".join([computer_partition_path, garbage_file])) garbage_path = "/".join([computer_partition_path, garbage_file])
if os.path.isfile(garbage_path):
os.unlink(garbage_path)
else:
shutil.rmtree(garbage_path)
if os.listdir(computer_partition_path) != []: if os.listdir(computer_partition_path) != []:
self.logger.warning("Free partition %s contains file(s) in %s." % ( self.logger.warning("Free partition %s contains file(s) in %s." % (
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment