mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-10-08 01:40:31 +00:00
parent
6dac2abd7b
commit
df32bf4792
5 changed files with 23 additions and 16 deletions
|
@ -1,3 +1,6 @@
|
||||||
|
from bootstrapvz.common.tools import rel_path
|
||||||
|
|
||||||
|
assets = rel_path(__file__, 'assets')
|
||||||
|
|
||||||
|
|
||||||
def validate_manifest(data, validator, error):
|
def validate_manifest(data, validator, error):
|
||||||
|
@ -11,11 +14,15 @@ def resolve_tasks(taskset, manifest):
|
||||||
from bootstrapvz.common.tasks import apt
|
from bootstrapvz.common.tasks import apt
|
||||||
from bootstrapvz.common.tasks import initd
|
from bootstrapvz.common.tasks import initd
|
||||||
from bootstrapvz.common.tasks import ssh
|
from bootstrapvz.common.tasks import ssh
|
||||||
|
|
||||||
from bootstrapvz.common.releases import wheezy
|
from bootstrapvz.common.releases import wheezy
|
||||||
|
from bootstrapvz.common.releases import jessie
|
||||||
|
|
||||||
if manifest.release == wheezy:
|
if manifest.release == wheezy:
|
||||||
taskset.add(apt.AddBackports)
|
taskset.add(apt.AddBackports)
|
||||||
|
|
||||||
|
if manifest.release >= jessie:
|
||||||
|
taskset.add(tasks.SetCloudInitMountOptions)
|
||||||
|
|
||||||
taskset.update([tasks.SetMetadataSource,
|
taskset.update([tasks.SetMetadataSource,
|
||||||
tasks.AddCloudInitPackages,
|
tasks.AddCloudInitPackages,
|
||||||
])
|
])
|
||||||
|
|
|
@ -3,8 +3,10 @@ from bootstrapvz.common import phases
|
||||||
from bootstrapvz.common.tools import log_check_call
|
from bootstrapvz.common.tools import log_check_call
|
||||||
from bootstrapvz.common.tasks import apt
|
from bootstrapvz.common.tasks import apt
|
||||||
from bootstrapvz.common.tasks import locale
|
from bootstrapvz.common.tasks import locale
|
||||||
|
from . import assets
|
||||||
|
from shutil import copy
|
||||||
import logging
|
import logging
|
||||||
import os.path
|
import os
|
||||||
|
|
||||||
|
|
||||||
class AddCloudInitPackages(Task):
|
class AddCloudInitPackages(Task):
|
||||||
|
@ -121,3 +123,15 @@ class EnableModules(Task):
|
||||||
if int(entry['position']) == int(count):
|
if int(entry['position']) == int(count):
|
||||||
print(" - %s" % entry['module'])
|
print(" - %s" % entry['module'])
|
||||||
print line,
|
print line,
|
||||||
|
|
||||||
|
|
||||||
|
class SetCloudInitMountOptions(Task):
|
||||||
|
description = 'Setting cloud-init default mount options'
|
||||||
|
phase = phases.system_modification
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def run(cls, info):
|
||||||
|
cloud_init_src = os.path.join(assets, 'cloud-init/debian_cloud.cfg')
|
||||||
|
cloud_init_dst = os.path.join(info.root, 'etc/cloud/cloud.cfg.d/01_debian_cloud.cfg')
|
||||||
|
copy(cloud_init_src, cloud_init_dst)
|
||||||
|
os.chmod(cloud_init_dst, 0644)
|
||||||
|
|
|
@ -86,7 +86,6 @@ def resolve_tasks(taskset, manifest):
|
||||||
taskset.add(tasks.network.EnableDHCPCDDNS)
|
taskset.add(tasks.network.EnableDHCPCDDNS)
|
||||||
|
|
||||||
if manifest.release >= jessie:
|
if manifest.release >= jessie:
|
||||||
taskset.add(tasks.tuning.SetCloudInitMountOptions)
|
|
||||||
taskset.add(tasks.packages.AddWorkaroundGrowpart)
|
taskset.add(tasks.packages.AddWorkaroundGrowpart)
|
||||||
taskset.add(initd.AdjustGrowpartWorkaround)
|
taskset.add(initd.AdjustGrowpartWorkaround)
|
||||||
if manifest.system['bootloader'] == 'grub':
|
if manifest.system['bootloader'] == 'grub':
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
from bootstrapvz.base import Task
|
from bootstrapvz.base import Task
|
||||||
from bootstrapvz.common import phases
|
from bootstrapvz.common import phases
|
||||||
from . import assets
|
from . import assets
|
||||||
from shutil import copy
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,18 +16,6 @@ class TuneSystem(Task):
|
||||||
os.chmod(sysctl_dst, 0644)
|
os.chmod(sysctl_dst, 0644)
|
||||||
|
|
||||||
|
|
||||||
class SetCloudInitMountOptions(Task):
|
|
||||||
description = 'Setting cloud-init default mount options'
|
|
||||||
phase = phases.system_modification
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def run(cls, info):
|
|
||||||
cloud_init_src = os.path.join(assets, 'cloud-init/debian_cloud.cfg')
|
|
||||||
cloud_init_dst = os.path.join(info.root, 'etc/cloud/cloud.cfg.d/01_debian_cloud.cfg')
|
|
||||||
copy(cloud_init_src, cloud_init_dst)
|
|
||||||
os.chmod(cloud_init_dst, 0644)
|
|
||||||
|
|
||||||
|
|
||||||
class BlackListModules(Task):
|
class BlackListModules(Task):
|
||||||
description = 'Blacklisting unused kernel modules'
|
description = 'Blacklisting unused kernel modules'
|
||||||
phase = phases.system_modification
|
phase = phases.system_modification
|
||||||
|
|
Loading…
Add table
Reference in a new issue