minimize_size: Split AddRequiredCommands into command-specific tasks

This commit is contained in:
Tomasz Melcer 2018-01-13 02:34:28 +01:00
parent 95efdaaced
commit 6a96a2b5b1
2 changed files with 16 additions and 9 deletions

View file

@ -18,10 +18,10 @@ def resolve_tasks(taskset, manifest):
tasks.mounts.RemoveFolderMounts, tasks.mounts.RemoveFolderMounts,
]) ])
if manifest.plugins['minimize_size'].get('zerofree', False): if manifest.plugins['minimize_size'].get('zerofree', False):
taskset.add(tasks.shrink.AddRequiredCommands) taskset.add(tasks.shrink.AddRequiredZeroFreeCommand)
taskset.add(tasks.shrink.Zerofree) taskset.add(tasks.shrink.Zerofree)
if manifest.plugins['minimize_size'].get('shrink', False): if manifest.plugins['minimize_size'].get('shrink', False):
taskset.add(tasks.shrink.AddRequiredCommands) taskset.add(tasks.shrink.AddRequiredVDiskManagerCommand)
taskset.add(tasks.shrink.ShrinkVolume) taskset.add(tasks.shrink.ShrinkVolume)
if 'apt' in manifest.plugins['minimize_size']: if 'apt' in manifest.plugins['minimize_size']:
apt = manifest.plugins['minimize_size']['apt'] apt = manifest.plugins['minimize_size']['apt']

View file

@ -8,18 +8,25 @@ from bootstrapvz.common.tools import log_check_call
import os import os
class AddRequiredCommands(Task): class AddRequiredZeroFreeCommand(Task):
description = 'Adding commands required for reducing volume size' description = 'Adding command required for zero-ing volume'
phase = phases.validation phase = phases.validation
successors = [host.CheckExternalCommands] successors = [host.CheckExternalCommands]
@classmethod @classmethod
def run(cls, info): def run(cls, info):
if info.manifest.plugins['minimize_size'].get('zerofree', False): info.host_dependencies['zerofree'] = 'zerofree'
info.host_dependencies['zerofree'] = 'zerofree'
if info.manifest.plugins['minimize_size'].get('shrink', False):
link = 'https://my.vmware.com/web/vmware/info/slug/desktop_end_user_computing/vmware_workstation/10_0' class AddRequiredVDiskManagerCommand(Task):
info.host_dependencies['vmware-vdiskmanager'] = link description = 'Adding command required for reducing volume size'
phase = phases.validation
successors = [host.CheckExternalCommands]
@classmethod
def run(cls, info):
link = 'https://my.vmware.com/web/vmware/info/slug/desktop_end_user_computing/vmware_workstation/10_0'
info.host_dependencies['vmware-vdiskmanager'] = link
class Zerofree(Task): class Zerofree(Task):