mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-10-07 17:40:30 +00:00
Remove usage of glob
This commit is contained in:
parent
6671a67d9b
commit
f5a2acf128
3 changed files with 10 additions and 14 deletions
|
@ -64,9 +64,8 @@ class AptClean(Task):
|
|||
def run(self, info):
|
||||
log_check_call(['chroot', info.root, 'apt-get', 'clean'])
|
||||
|
||||
import glob
|
||||
lists = glob.glob(os.path.join(info.root, 'var/lib/apt/lists/*'))
|
||||
for list_file in lists:
|
||||
lists = os.path.join(info.root, 'var/lib/apt/lists')
|
||||
for list_file in [os.path.join(lists, f) for f in os.listdir(lists)]:
|
||||
if os.path.isfile(list_file):
|
||||
os.remove(list_file)
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from base import Task
|
||||
from common import phases
|
||||
import os.path
|
||||
import os
|
||||
|
||||
|
||||
class ConfigureGrub(Task):
|
||||
|
@ -14,10 +14,8 @@ class ConfigureGrub(Task):
|
|||
stat.S_IROTH | stat.S_IXOTH)
|
||||
x_all = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH
|
||||
|
||||
import os
|
||||
import glob
|
||||
grub2_cfgs = glob.glob(os.path.join(info.root, 'etc/grub.d/*'))
|
||||
for cfg in grub2_cfgs:
|
||||
grubd = os.path.join(info.root, 'etc/grub.d')
|
||||
for cfg in [os.path.join(grubd, f) for f in os.listdir(grubd)]:
|
||||
os.chmod(cfg, os.stat(cfg).st_mode & ~ x_all)
|
||||
|
||||
from shutil import copy
|
||||
|
|
|
@ -34,11 +34,10 @@ class CleanTMP(Task):
|
|||
phase = phases.system_cleaning
|
||||
|
||||
def run(self, info):
|
||||
import glob
|
||||
tmp_files = glob.glob(os.path.join(info.root, 'tmp/*'))
|
||||
for tmp_file in tmp_files:
|
||||
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)
|
||||
|
||||
log_files = glob.glob(os.path.join(info.root, 'var/log/{bootstrap,dpkg}.log'))
|
||||
for log_file in log_files:
|
||||
os.remove(log_file)
|
||||
log = os.path.join(info.root, 'var/log/')
|
||||
os.remove(os.path.join(log, 'bootstrap.log'))
|
||||
os.remove(os.path.join(log, 'dpkg.log'))
|
||||
|
|
Loading…
Add table
Reference in a new issue