mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-24 07:26:29 +00:00
Add the 'apt.conf.d' manifest subsection
This commit is contained in:
parent
2b6dc47b90
commit
4cc9ec0d1b
5 changed files with 47 additions and 1 deletions
|
@ -32,3 +32,14 @@ def validate_manifest(data, validator, error):
|
||||||
|
|
||||||
if release == squeeze:
|
if release == squeeze:
|
||||||
error('Grub installation on squeeze is not supported', ['system', 'bootloader'])
|
error('Grub installation on squeeze is not supported', ['system', 'bootloader'])
|
||||||
|
|
||||||
|
# Check the provided apt.conf(5) options
|
||||||
|
if 'packages' in data:
|
||||||
|
for name, val in data['packages'].get('apt.conf.d', {}).iteritems():
|
||||||
|
from bootstrapvz.common.tools import log_call
|
||||||
|
|
||||||
|
status, _, _ = log_call(['apt-config', '-c=/dev/stdin', 'dump'],
|
||||||
|
stdin=val + '\n')
|
||||||
|
|
||||||
|
if status != 0:
|
||||||
|
error('apt.conf(5) syntax error', ['packages', 'apt.conf.d', name])
|
||||||
|
|
|
@ -100,6 +100,13 @@ properties:
|
||||||
minItems: 1
|
minItems: 1
|
||||||
minProperties: 1
|
minProperties: 1
|
||||||
additionalProperties: false
|
additionalProperties: false
|
||||||
|
apt.conf.d:
|
||||||
|
type: object
|
||||||
|
patternProperties:
|
||||||
|
^[0-9A-Za-z][0-9A-Za-z-_.]+$:
|
||||||
|
type: string
|
||||||
|
minProperties: 1
|
||||||
|
additionalProperties: false
|
||||||
sources:
|
sources:
|
||||||
type: object
|
type: object
|
||||||
patternProperties:
|
patternProperties:
|
||||||
|
|
|
@ -125,6 +125,8 @@ def get_apt_group(manifest):
|
||||||
if 'preferences' in manifest.packages:
|
if 'preferences' in manifest.packages:
|
||||||
group.append(apt.AddManifestPreferences)
|
group.append(apt.AddManifestPreferences)
|
||||||
group.append(apt.WritePreferences)
|
group.append(apt.WritePreferences)
|
||||||
|
if 'apt.conf.d' in manifest.packages:
|
||||||
|
group.append(apt.WriteConfiguration)
|
||||||
if 'install' in manifest.packages:
|
if 'install' in manifest.packages:
|
||||||
group.append(packages.AddManifestPackages)
|
group.append(packages.AddManifestPackages)
|
||||||
if manifest.packages.get('install_standard', False):
|
if manifest.packages.get('install_standard', False):
|
||||||
|
|
|
@ -80,6 +80,22 @@ class InstallTrustedKeys(Task):
|
||||||
copy(key_path, destination)
|
copy(key_path, destination)
|
||||||
|
|
||||||
|
|
||||||
|
class WriteConfiguration(Task):
|
||||||
|
decription = 'Write configuration to apt.conf.d from the manifest'
|
||||||
|
phase = phases.package_installation
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def run(cls, info):
|
||||||
|
for name, val in info.manifest.packages.get('apt.conf.d', {}).iteritems():
|
||||||
|
if name == 'main':
|
||||||
|
path = os.path.join(info.root, 'etc/apt/apt.conf')
|
||||||
|
else:
|
||||||
|
path = os.path.join(info.root, 'etc/apt/apt.conf.d', name)
|
||||||
|
|
||||||
|
with open(path, 'w') as conf_file:
|
||||||
|
conf_file.write(val + '\n')
|
||||||
|
|
||||||
|
|
||||||
class WriteSources(Task):
|
class WriteSources(Task):
|
||||||
description = 'Writing aptitude sources to disk'
|
description = 'Writing aptitude sources to disk'
|
||||||
phase = phases.package_installation
|
phase = phases.package_installation
|
||||||
|
@ -138,7 +154,7 @@ class DisableDaemonAutostart(Task):
|
||||||
class AptUpdate(Task):
|
class AptUpdate(Task):
|
||||||
description = 'Updating the package cache'
|
description = 'Updating the package cache'
|
||||||
phase = phases.package_installation
|
phase = phases.package_installation
|
||||||
predecessors = [locale.GenerateLocale, WriteSources, WritePreferences]
|
predecessors = [locale.GenerateLocale, WriteConfiguration, WriteSources, WritePreferences]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls, info):
|
def run(cls, info):
|
||||||
|
|
|
@ -210,6 +210,11 @@ variety of sources.
|
||||||
be added to the aptitude keyring of trusted signatures for
|
be added to the aptitude keyring of trusted signatures for
|
||||||
repositories.
|
repositories.
|
||||||
``optional``
|
``optional``
|
||||||
|
- ``apt.conf.d``: A map of ``apt.conf(5)`` configuration snippets.
|
||||||
|
The key become the filename in ``/etc/apt/apt.conf.d``, except
|
||||||
|
``main`` which designates ``/etc/apt/apt.conf``.
|
||||||
|
The value is a string in the ``apt.conf(5)`` syntax.
|
||||||
|
``optional``
|
||||||
- ``preferences``: Allows you to pin packages through `apt
|
- ``preferences``: Allows you to pin packages through `apt
|
||||||
preferences <https://wiki.debian.org/AptPreferences>`__. The setting
|
preferences <https://wiki.debian.org/AptPreferences>`__. The setting
|
||||||
is an object where the key is the preference filename in
|
is an object where the key is the preference filename in
|
||||||
|
@ -242,6 +247,11 @@ Example:
|
||||||
- non-free
|
- non-free
|
||||||
trusted-keys:
|
trusted-keys:
|
||||||
- /root/keys/puppet.gpg
|
- /root/keys/puppet.gpg
|
||||||
|
apt.conf.d:
|
||||||
|
00InstallRecommends: >-
|
||||||
|
APT::Install-Recommends "false";
|
||||||
|
APT::Install-Suggests "false";
|
||||||
|
00IPv4: 'Acquire::ForceIPv4 "false";'
|
||||||
preferences:
|
preferences:
|
||||||
main:
|
main:
|
||||||
- package: *
|
- package: *
|
||||||
|
|
Loading…
Add table
Reference in a new issue