mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-22 09:50:37 +00:00
Move ModifyFSTab task to filesystem
This commit is contained in:
parent
14d6f5fb4f
commit
501b336d0e
3 changed files with 19 additions and 18 deletions
|
@ -43,7 +43,7 @@ def tasks(tasklist, manifest):
|
|||
apt.AptSources(),
|
||||
apt.AptUpgrade(),
|
||||
boot.ConfigureGrub(),
|
||||
boot.ModifyFstab(),
|
||||
filesystem.ModifyFstab(),
|
||||
boot.BlackListModules(),
|
||||
boot.DisableGetTTYs(),
|
||||
security.EnableShadowConfig(),
|
||||
|
|
|
@ -35,23 +35,6 @@ class ConfigureGrub(Task):
|
|||
log_check_call(['chroot', info.root, 'ln', '-s', '/boot/grub/grub.cfg', '/boot/grub/menu.lst'])
|
||||
|
||||
|
||||
class ModifyFstab(Task):
|
||||
description = 'Adding root volume to the fstab'
|
||||
phase = phases.system_modification
|
||||
|
||||
def run(self, info):
|
||||
mount_opts = ['defaults']
|
||||
if info.manifest.volume['filesystem'].lower() in ['ext2', 'ext3', 'ext4']:
|
||||
mount_opts.append('barrier=0')
|
||||
if info.manifest.volume['filesystem'].lower() == 'xfs':
|
||||
mount_opts.append('nobarrier')
|
||||
fstab_path = os.path.join(info.root, 'etc/fstab')
|
||||
with open(fstab_path, 'a') as fstab:
|
||||
fstab.write(('/dev/xvda1 / {filesystem} {mount_opts} 1 1'
|
||||
.format(filesystem=info.manifest.volume['filesystem'].lower(),
|
||||
mount_opts=','.join(mount_opts))))
|
||||
|
||||
|
||||
class BlackListModules(Task):
|
||||
description = 'Blacklisting kernel modules'
|
||||
phase = phases.system_modification
|
||||
|
|
|
@ -105,3 +105,21 @@ class DeleteMountDir(Task):
|
|||
import os
|
||||
os.rmdir(info.root)
|
||||
del info.root
|
||||
|
||||
|
||||
class ModifyFstab(Task):
|
||||
description = 'Adding root volume to the fstab'
|
||||
phase = phases.system_modification
|
||||
|
||||
def run(self, info):
|
||||
import os.path
|
||||
mount_opts = ['defaults']
|
||||
if info.manifest.volume['filesystem'].lower() in ['ext2', 'ext3', 'ext4']:
|
||||
mount_opts.append('barrier=0')
|
||||
if info.manifest.volume['filesystem'].lower() == 'xfs':
|
||||
mount_opts.append('nobarrier')
|
||||
fstab_path = os.path.join(info.root, 'etc/fstab')
|
||||
with open(fstab_path, 'a') as fstab:
|
||||
fstab.write(('/dev/xvda1 / {filesystem} {mount_opts} 1 1'
|
||||
.format(filesystem=info.manifest.volume['filesystem'].lower(),
|
||||
mount_opts=','.join(mount_opts))))
|
||||
|
|
Loading…
Add table
Reference in a new issue