bootstrap-vz/bootstrapvz/base/__init__.py

23 lines
886 B
Python
Raw Normal View History

from phase import Phase
2013-12-29 23:52:08 +01:00
from task import Task
2013-06-09 16:10:43 +02:00
from main import main
2015-02-22 16:44:58 +01:00
__all__ = ['Phase', 'Task', 'main']
def validate_manifest(data, validator, error):
2014-03-23 16:04:03 +01:00
"""Validates the manifest using the base manifest
:param dict data: The data of the manifest
:param function validator: The function that validates the manifest given the data and a path
:param function error: The function tha raises an error when the validation fails
2014-03-23 16:04:03 +01:00
"""
import os.path
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
validator(data, schema_path)
# Check the bootloader/partitioning configuration.
# Doing this via the schema is a pain and does not output a useful error message.
if data['system']['bootloader'] == 'grub' and data['volume']['partitions']['type'] == 'none':
error('Grub cannot boot from unpartitioned disks', ['system', 'bootloader'])