Closed EmersonPrado closed 1 year ago
You can already configure this (and a lot more other things) with the API using the dnf.conf.Conf
. You can check the docs: https://dnf.readthedocs.io/en/latest/api_conf.html, for a list of all configuration options (both main dnf config and repo specific config) you can check: https://dnf.readthedocs.io/en/latest/conf_ref.html.
skip_if_unavailable
is an option for both main and repo so assuming your repo configuration doesn't override the value to False
you can do:
import dnf
base = dnf.Base()
conf = base.conf
conf.skip_if_unavailable = True
base.read_all_repos()
base.fill_sack()
Perfect! Thanks a lot!
I intend to write a Puppet external custom fact, using DNF's Python API, which would collect all DNF modules data and output as YAML data, ready to be consumed by Puppet Facter.
If any of the DNF repository fails, the DNF Python API fails in the fill_sack step.
My code relevant excerpt:
This last call fails with:
I understand the repo issue has to be dealt with. But I'd like my Python code to keep running, with the working repos, to yield useful information, while the repo is fixed elsewhere.
Method Base.fill_sack already uses attribute
Base.repos.iter_enabled.skip_if_unavailable
or something like that for the purpose I need. But I think this attribute is not available for the Base.fill_sack caller:So my request is a parameter in
Base.fill_sack
which could setskip_if_unavailable
toTrue