Move hack for growpart to its own task.

This commit is contained in:
Zach Marano 2016-03-02 16:19:57 -08:00
parent 6c03860eac
commit 3f208b985f
2 changed files with 12 additions and 1 deletions

View file

@ -58,7 +58,6 @@ class AdjustExpandRootScript(Task):
@classmethod
def run(cls, info):
from ..tools import sed_i
from bootstrapvz.common.releases import jessie
script = os.path.join(info.root, 'etc/init.d/expand-root')
root_idx = info.volume.partition_map.root.get_index()
@ -68,5 +67,16 @@ class AdjustExpandRootScript(Task):
root_device_path = 'root_device_path="{device}"'.format(device=info.volume.device_path)
sed_i(script, '^root_device_path="/dev/xvda"$', root_device_path)
class AdjustGrowpartWorkaround(Task):
description = 'Adjusting expand-root for growpart-workaround'
phase = phases.system_modification
predecessors = [AdjustExpandRootScript]
@classmethod
def run(cls, info):
from ..tools import sed_i
from bootstrapvz.common.releases import jessie
if info.manifest.release >= jessie:
sed_i(script, '^growpart="growpart"$', 'growpart-workaround')

View file

@ -89,6 +89,7 @@ def resolve_tasks(taskset, manifest):
if manifest.volume['partitions']['type'] != 'none':
taskset.add(initd.AdjustExpandRootScript)
taskset.add(initd.AdjustGrowpartWorkaround)
if manifest.system['bootloader'] == 'pvgrub':
taskset.add(grub.AddGrubPackage)