ec2: Move cloud-init mount tuning to cloud-init plugin

Fixes #406
This commit is contained in:
Anders Ingemann 2017-11-09 20:16:19 +01:00
parent 6dac2abd7b
commit df32bf4792
No known key found for this signature in database
GPG key ID: 16A5864B259E59CD
5 changed files with 23 additions and 16 deletions

View file

@ -1,3 +1,6 @@
from bootstrapvz.common.tools import rel_path
assets = rel_path(__file__, 'assets')
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 initd
from bootstrapvz.common.tasks import ssh
from bootstrapvz.common.releases import wheezy
from bootstrapvz.common.releases import jessie
if manifest.release == wheezy:
taskset.add(apt.AddBackports)
if manifest.release >= jessie:
taskset.add(tasks.SetCloudInitMountOptions)
taskset.update([tasks.SetMetadataSource,
tasks.AddCloudInitPackages,
])

View file

@ -3,8 +3,10 @@ from bootstrapvz.common import phases
from bootstrapvz.common.tools import log_check_call
from bootstrapvz.common.tasks import apt
from bootstrapvz.common.tasks import locale
from . import assets
from shutil import copy
import logging
import os.path
import os
class AddCloudInitPackages(Task):
@ -121,3 +123,15 @@ class EnableModules(Task):
if int(entry['position']) == int(count):
print(" - %s" % entry['module'])
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)

View file

@ -86,7 +86,6 @@ def resolve_tasks(taskset, manifest):
taskset.add(tasks.network.EnableDHCPCDDNS)
if manifest.release >= jessie:
taskset.add(tasks.tuning.SetCloudInitMountOptions)
taskset.add(tasks.packages.AddWorkaroundGrowpart)
taskset.add(initd.AdjustGrowpartWorkaround)
if manifest.system['bootloader'] == 'grub':

View file

@ -1,7 +1,6 @@
from bootstrapvz.base import Task
from bootstrapvz.common import phases
from . import assets
from shutil import copy
import os
@ -17,18 +16,6 @@ class TuneSystem(Task):
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):
description = 'Blacklisting unused kernel modules'
phase = phases.system_modification