Generalize "grub only on partitioned volumes" err

(move it into base manifest validation)
This commit is contained in:
Anders Ingemann 2014-05-03 13:37:05 +02:00
parent 0a2cd86b4b
commit 7958950d19
5 changed files with 6 additions and 11 deletions

View file

@ -71,6 +71,12 @@ class Manifest(object):
from . import validate_manifest
# Validate the manifest with the base validation function in __init__
validate_manifest(self.data, self.schema_validator, self.validation_error)
# Check the bootloader/partitioning configuration.
# Doing this via the schema is a pain and does not output a useful error message.
# This should be put into a separat function if there is more that should be checked like this.
if self.data['system']['bootloader'] == 'grub' and self.data['volume']['partitions']['type'] == 'none':
self.validation_error('Grub cannot boot from unpartitioned disks', ['system', 'bootloader'])
# Run the provider validation
self.modules['provider'].validate_manifest(self.data, self.schema_validator, self.validation_error)
# Run the validation function for any plugin that has it

View file

@ -20,9 +20,6 @@ def validate_manifest(data, validator, error):
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.json'))
validator(data, schema_path)
if data['volume']['partitions']['type'] == 'none' and data['system']['bootloader'] != 'extlinux':
error('Only extlinux can boot from unpartitioned disks', ['system', 'bootloader'])
def resolve_tasks(taskset, manifest):
taskset.update(task_groups.get_standard_groups(manifest))

View file

@ -43,8 +43,6 @@ def validate_manifest(data, validator, error):
error('Paravirtualized AMIs only support pvgrub as a bootloader', ['system', 'bootloader'])
if data['virtualization'] == 'hvm' and data['system']['bootloader'] == 'pvgrub':
error('HVM AMIs only support extlinux as a bootloader', ['system', 'bootloader'])
if data['volume']['partitions']['type'] == 'none' and data['system']['bootloader'] == 'grub':
error('Grub cannot boot from unpartitioned disks', ['system', 'bootloader'])
def resolve_tasks(taskset, manifest):

View file

@ -18,9 +18,6 @@ def validate_manifest(data, validator, error):
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.json'))
validator(data, schema_path)
if data['volume']['partitions']['type'] == 'none' and data['system']['bootloader'] != 'extlinux':
error('Only extlinux can boot from unpartitioned disks', ['system', 'bootloader'])
def resolve_tasks(taskset, manifest):
taskset.update(task_groups.get_standard_groups(manifest))

View file

@ -16,9 +16,6 @@ def validate_manifest(data, validator, error):
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.json'))
validator(data, schema_path)
if data['volume']['partitions']['type'] == 'none' and data['system']['bootloader'] != 'extlinux':
error('Only extlinux can boot from unpartitioned disks', ['system', 'bootloader'])
def resolve_tasks(taskset, manifest):
taskset.update(task_groups.get_standard_groups(manifest))