mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-24 15:36:27 +00:00
Merge pull request #121 from osallou/cleanup_dirs
if tmp contains directories, cleanup task fails. Add management for directories too
This commit is contained in:
commit
c0021e0c46
1 changed files with 5 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
||||||
from base import Task
|
from base import Task
|
||||||
from common import phases
|
from common import phases
|
||||||
import os
|
import os
|
||||||
|
import shutil
|
||||||
|
|
||||||
|
|
||||||
class ClearMOTD(Task):
|
class ClearMOTD(Task):
|
||||||
|
@ -36,7 +37,10 @@ class CleanTMP(Task):
|
||||||
def run(self, info):
|
def run(self, info):
|
||||||
tmp = os.path.join(info.root, 'tmp')
|
tmp = os.path.join(info.root, 'tmp')
|
||||||
for tmp_file in [os.path.join(tmp, f) for f in os.listdir(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/')
|
log = os.path.join(info.root, 'var/log/')
|
||||||
os.remove(os.path.join(log, 'bootstrap.log'))
|
os.remove(os.path.join(log, 'bootstrap.log'))
|
||||||
|
|
Loading…
Add table
Reference in a new issue