On 2023-10-13 11:40:17, Antoine Beaupré wrote:

[...]

> I agree this is a little odd and that the prometheus apt plugin should
> probably not be the one handling the cache update.

I have made a patch upstream for this:

https://github.com/prometheus-community/node-exporter-textfile-collector-scripts/pull/181

I believe this would fix this issue as far as apt_info.py is concerned.

I do feel there's an outstanding issue here in apt, however, but that's
probably better served by another bug report.

[...]

> Could you expand on this? What's the proper pythonic way of doing this?
>
> The script currently does:
>
>     cache = apt.cache.Cache()
>     with contextlib.suppress(apt.cache.LockFailedException, 
> apt.cache.FetchFailedException):
>         cache.update()
>
>     cache.open()
>     cache.upgrade(True)
>
> What's the locking part here? Is this sufficient?
>
>     cache = apt.cache.Cache()

I have just done that, @jak it would be great if you could just +1 the
above...

Thanks again!

Reply via email to