mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-22 18:00:35 +00:00
Move cleanup tasks to common tasks module
This commit is contained in:
parent
8767e414ac
commit
b36e611742
4 changed files with 2 additions and 45 deletions
|
@ -15,7 +15,7 @@ from common.tasks import boot as common_boot
|
|||
from tasks import security
|
||||
from tasks import network
|
||||
from tasks import initd
|
||||
from tasks import cleanup
|
||||
from common.tasks import cleanup
|
||||
|
||||
|
||||
def initialize():
|
||||
|
|
|
@ -11,7 +11,7 @@ from common.tasks import boot as common_boot
|
|||
from tasks import security
|
||||
from tasks import network
|
||||
from tasks import initd
|
||||
from tasks import cleanup
|
||||
from common.tasks import cleanup
|
||||
|
||||
|
||||
def initialize():
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
from base import Task
|
||||
from common import phases
|
||||
import os
|
||||
|
||||
|
||||
class ClearMOTD(Task):
|
||||
description = 'Clearing the MOTD'
|
||||
phase = phases.system_cleaning
|
||||
|
||||
def run(self, info):
|
||||
with open('/var/run/motd', 'w'):
|
||||
pass
|
||||
|
||||
|
||||
class ShredHostkeys(Task):
|
||||
description = 'Securely deleting ssh hostkeys'
|
||||
phase = phases.system_cleaning
|
||||
|
||||
def run(self, info):
|
||||
ssh_hostkeys = ['ssh_host_dsa_key',
|
||||
'ssh_host_rsa_key']
|
||||
if info.manifest.system['release'] != 'squeeze':
|
||||
ssh_hostkeys.append('ssh_host_ecdsa_key')
|
||||
|
||||
private = [os.path.join(info.root, 'etc/ssh', name) for name in ssh_hostkeys]
|
||||
public = [path + '.pub' for path in private]
|
||||
|
||||
from common.tools import log_check_call
|
||||
log_check_call(['/usr/bin/shred', '--remove'] + private + public)
|
||||
|
||||
|
||||
class CleanTMP(Task):
|
||||
description = 'Removing temporary files'
|
||||
phase = phases.system_cleaning
|
||||
|
||||
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)
|
||||
|
||||
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