-
-
Notifications
You must be signed in to change notification settings - Fork 468
Description
Describe the bug
the AptSources fact only recognises "old" style .list files. The newer .sources are not recognised
To Reproduce
Have a .sources file in /etc/apt/sources.list.d . E.g.:
Types: deb
URIs: https://download.vscodium.com/debs
Suites: vscodium
Components: main
Architectures: amd64 arm64
Signed-by: /usr/share/keyrings/vscodium-archive-keyring.gpg
For the VSCodium apt repository.
Make sure you have the key installed
Run
print_r(host.get_fact(AptSources, ))
Observe that the vscodium apt source is not listed.
With the same steps, but with vscodium as a list, does return vscodium as an existing apt source.
This causes repositories that are converted from list to sources to fail to recognise they are already installed, and the list is re-installed.
Expected behavior
.sources files in /etc/apt/sources.list.d are correctly recognised and parsed, and show up correctly when the apt sources fact is used.
Meta
- Include output of
pyinfra --support.
If you are having issues with pyinfra or wish to make feature requests, please
check out the GitHub issues at https://github.com/Fizzadar/pyinfra/issues .
When adding an issue, be sure to include the following:
System: Linux
Platform: Linux-6.14.0-37-generic-x86_64-with-glibc2.39
Release: 6.14.0-37-generic
Machine: x86_64
pyinfra: v3.6
click: v8.3.1
distro: v1.9.0
gevent: v25.9.1
jinja2: v3.1.6
packaging: v25.0
paramiko: v3.5.1
pydantic: v2.12.5
python-dateutil: v2.9.0.post0
typeguard: v4.4.4
typing-extensions: v4.15.0
Executable: /home/firesphere/PycharmProjects/server-updates/.venv/bin/pyinfra
Python: 3.13.9 (CPython, Clang 21.1.4 )
- How was pyinfra installed (source/pip)?
uv tool install - Include pyinfra-debug.log (if one was created)
- Consider including output with
-vvand--debug.
output ofprint(host.get_fact(AptSources, ):
[Jormungandr] >>> sudo -H -n sh -c '! command -v apt >/dev/null || (! test -f /etc/apt/sources.list || cat /etc/apt/sources.list) && (cat /etc/apt/sources.list.d/*.list || true)'
[Jormungandr] Loaded fact apt.AptSources
[{'options': {}, 'type': 'deb', 'url': 'http://archive.ubuntu.com/ubuntu/', 'distribution': 'noble', 'components': ['main', 'restricted', 'universe', 'multiverse']}, {'options': {}, 'type': 'deb', 'url': 'http://security.ubuntu.com/ubuntu/', 'distribution': 'noble-security', 'components': ['main', 'restricted', 'universe', 'multiverse']}, {'options': {}, 'type': 'deb', 'url': 'http://archive.ubuntu.com/ubuntu/', 'distribution': 'noble-updates', 'components': ['main', 'restricted', 'universe', 'multiverse']}, {'options': {'arch': 'amd64', 'signed-by': '/etc/apt/keyrings/docker.asc'}, 'type': 'deb', 'url': 'https://download.docker.com/linux/ubuntu', 'distribution': 'noble', 'components': ['stable']}]
Despite I very much have multiple sources installed. The command executed however, only looks at lists. The resulting list of repositories is a remnant that happens to be in my /etc/apt/sources.list file.