mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-22 09:50:37 +00:00
if tmp contains directories, cleanup task fails. Add maanagement for directories
This commit is contained in:
parent
d35b131c8f
commit
14b60bd364
1 changed files with 5 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
|||
from base import Task
|
||||
from common import phases
|
||||
import os
|
||||
import shutil
|
||||
|
||||
|
||||
class ClearMOTD(Task):
|
||||
|
@ -36,7 +37,10 @@ class CleanTMP(Task):
|
|||
def run(self, info):
|
||||
tmp = os.path.join(info.root, 'tmp')
|
||||
for tmp_file in [os.path.join(tmp, f) for f in os.listdir(tmp)]:
|
||||
os.remove(tmp_file)
|
||||
if os.path.isfile(tmp_file):
|
||||
os.remove(tmp_file)
|
||||
else:
|
||||
shutil.rmtree(tmp_file)
|
||||
|
||||
log = os.path.join(info.root, 'var/log/')
|
||||
os.remove(os.path.join(log, 'bootstrap.log'))
|
||||
|
|
Loading…
Add table
Reference in a new issue