Bug#1095441: wishlist: add a tool to validate sources.list and .sources files
Package: apt
Version: 2.9.27
Severity: wishlist
X-Debbugs-Cc: debian@rocketjump.eu
Hi Julian,
when using configuration management tools like ansible it's nice to have a
method to validate a templated sources.list/.sources file before writing it to
it's final location, e.g.
apt-validate /tmp/tmp.ptsTUMNbEH/kubernetes.sources
All the tool needs to do is return zero when it parses fine, and one when
there's a syntax error.
tools like systemd, borgmatic, sshd, icinga2, etc. have similar options.
This would allow to use following task in ansible:
- name: Template .sources file
template:
src: sources.j2
dest: /etc/apt/sources.list.d/{{ name }}.sources
owner: root
group: root
mode: "0644"
validate: '/usr/sbin/apt-validate %s'
notify: apt update
in the case of an error the destination file never gets written, preventing apt
from breaking and requiring manual intervention.
Hope I could explain why it would be nice to have, let me know if you have any
questions.
Greets,
Lee
-- System Information:
Debian Release: trixie/sid
APT prefers testing
APT policy: (990, 'testing')
Architecture: amd64 (x86_64)
Kernel: Linux 6.12.11-amd64 (SMP w/8 CPU threads; PREEMPT)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages apt depends on:
ii adduser 3.137
ii base-passwd 3.6.6
ii debian-archive-keyring 2023.4
ii libapt-pkg6.0t64 2.9.27
ii libc6 2.40-6
ii libgcc-s1 14.2.0-12
ii libseccomp2 2.5.5-2
ii libssl3t64 3.4.0-2
ii libstdc++6 14.2.0-12
ii libsystemd0 257.2-3
ii sqv 1.2.1-5
Versions of packages apt recommends:
ii ca-certificates 20241223
Versions of packages apt suggests:
pn apt-doc <none>
ii aptitude 0.8.13-6.1
ii dpkg-dev 1.22.14
ii gnupg 2.2.46-1
ii powermgmt-base 1.38
ii synaptic 0.91.5
-- no debconf information
Reply to: