From 7c5e5d111dac4ca554f24d2500eb15925d2a3d68 Mon Sep 17 00:00:00 2001 From: Nicolas Braud-Santoni Date: Mon, 22 Feb 2016 15:16:45 +0100 Subject: [PATCH 1/4] manifest-schema: Relax requirements for plugins This lets plugins define arbitrary datatypes for their configuration, not only objects. Also, `additionalProperties` was not specified, so entries with arbitrary names could be added. This isn't the case anymore. --- bootstrapvz/base/manifest-schema.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bootstrapvz/base/manifest-schema.yml b/bootstrapvz/base/manifest-schema.yml index 2582049..0bd0e5e 100644 --- a/bootstrapvz/base/manifest-schema.yml +++ b/bootstrapvz/base/manifest-schema.yml @@ -121,7 +121,8 @@ properties: plugins: type: object patternProperties: - ^\w+$: {type: object} + ^\w+$: {} + additionalProperties: false volume: type: object properties: From ad79b63c1938dfe6f9b9b577bf17581863ea7deb Mon Sep 17 00:00:00 2001 From: Nicolas Braud-Santoni Date: Mon, 22 Feb 2016 15:19:27 +0100 Subject: [PATCH 2/4] Add 'debconf' plugin Closes #282 --- bootstrapvz/plugins/debconf/__init__.py | 13 +++++++++++++ bootstrapvz/plugins/debconf/schema.yaml | 14 ++++++++++++++ bootstrapvz/plugins/debconf/tasks.py | 15 +++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 bootstrapvz/plugins/debconf/__init__.py create mode 100644 bootstrapvz/plugins/debconf/schema.yaml create mode 100644 bootstrapvz/plugins/debconf/tasks.py diff --git a/bootstrapvz/plugins/debconf/__init__.py b/bootstrapvz/plugins/debconf/__init__.py new file mode 100644 index 0000000..8e2b644 --- /dev/null +++ b/bootstrapvz/plugins/debconf/__init__.py @@ -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]) diff --git a/bootstrapvz/plugins/debconf/schema.yaml b/bootstrapvz/plugins/debconf/schema.yaml new file mode 100644 index 0000000..c73e340 --- /dev/null +++ b/bootstrapvz/plugins/debconf/schema.yaml @@ -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] diff --git a/bootstrapvz/plugins/debconf/tasks.py b/bootstrapvz/plugins/debconf/tasks.py new file mode 100644 index 0000000..9781dd9 --- /dev/null +++ b/bootstrapvz/plugins/debconf/tasks.py @@ -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']) From b4b7fa6bc26c2aef01f4bc4fe990c031f77b2368 Mon Sep 17 00:00:00 2001 From: Nicolas Braud-Santoni Date: Mon, 22 Feb 2016 15:36:37 +0100 Subject: [PATCH 3/4] plugins/debconf: Documentation --- bootstrapvz/plugins/debconf/README.rst | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 bootstrapvz/plugins/debconf/README.rst diff --git a/bootstrapvz/plugins/debconf/README.rst b/bootstrapvz/plugins/debconf/README.rst new file mode 100644 index 0000000..3c3432c --- /dev/null +++ b/bootstrapvz/plugins/debconf/README.rst @@ -0,0 +1,24 @@ +debconf +------- + +``debconf(7)`` is the configuration system for Debian packages. +It enables you to preconfigure packages before their installation. + +This plugin lets you specify debconf answers directly in the manifest. +You should only specify answers for packages that will be installed; the plugin +does not check that this is the case. + +Settings +~~~~~~~~ + +The ``debconf`` plugin directly takes an inline string::: + + plugins: + debconf: >- + d-i pkgsel/install-language-support boolean false + popularity-contest popularity-contest/participate boolean false + + +Consult ``debconf-set-selections(1)`` for a description of the data format. + + From fbed5f184b1ce137f7ee575e8c4573129906dc1c Mon Sep 17 00:00:00 2001 From: Nicolas Braud-Santoni Date: Tue, 23 Feb 2016 17:34:30 +0100 Subject: [PATCH 4/4] Update change log --- CHANGELOG.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 0f4f217..7e319b7 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,12 @@ Changelog ========= +2016-02-23 +---------- +Nicolas Braud-Santoni: + * #282, #290: Added 'debconf' plugin + * #290: Relaxed requirements on plugins manifests + 2016-02-10 ---------- Manoj Srivastava: