Add 'debconf' plugin

Closes #282
This commit is contained in:
Nicolas Braud-Santoni 2016-02-22 15:19:27 +01:00
parent 7c5e5d111d
commit ad79b63c19
3 changed files with 42 additions and 0 deletions

View file

@ -0,0 +1,13 @@
def validate_manifest(data, validator, error):
from bootstrapvz.common.tools import log_check_call
import os.path
schema_path = os.path.join(os.path.dirname(__file__),
'schema.yaml')
validator(data, schema_path)
log_check_call(['debconf-set-selections', '--checkonly'],
stdin=data['plugins']['debconf'])
def resolve_tasks(taskset, manifest):
import tasks
taskset.update([tasks.DebconfSetSelections])

View file

@ -0,0 +1,14 @@
$schema: http://json-schema.org/schema#
title: Manifest schema for the debconf plugin
type: object
properties:
plugins:
type: object
properties:
debconf:
name: Debconf selections to set
description: >-
This value should be an inline string in the
input format of debconf-set-selections(1).
type: string
required: [debconf]

View file

@ -0,0 +1,15 @@
from bootstrapvz.base import Task
from bootstrapvz.common import phases
from bootstrapvz.common.tasks import packages
from bootstrapvz.common.tools import log_check_call
class DebconfSetSelections(Task):
description = 'Set debconf(7) selections from the manifest'
phase = phases.package_installation
successors = [packages.InstallPackages]
@classmethod
def run(cls, info):
log_check_call(['chroot', info.root, 'debconf-set-selections'],
stdin=info.manifest.plugins['debconf'])