On Sat, Feb 08, 2025 at 12:34:15AM +0100, Lee Garrett wrote:
> Package: apt
> Version: 2.9.27
> Severity: wishlist
> X-Debbugs-Cc: deb...@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.

I'm not sure what that even means, tbh. Our parser is so lax that it's
more or less meaningless; you'll only get errors at update time when
it actually tries to use the sources.

-- 
debian developer - deb.li/jak | jak-linux.org - free software dev
ubuntu core developer                              i speak de, en

Reply via email to