dnf-json: set metadata_expire

We were using dnf's default of 48h, but that does not work for
updates repositories, as they depend on an expiration time of 6h.

Allow the metadata_expire value to be configured per repository.
If the value is unset, then never expire the metadata. Set the
value to 6h for all the fedora testing repos.

This fixes issue #476.

Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
Tom Gundersen 2020-04-03 18:28:22 +02:00
parent ae294f967d
commit bb85acf36f
5 changed files with 26 additions and 6 deletions

View file

@ -34,6 +34,13 @@ def dnfrepo(desc, parent_conf=None):
if desc.get("ignoressl", False):
repo.sslverify = False
# In dnf, the default metadata expiration time is 48 hours. However,
# some repositories never expire the metadata, and others expire it much
# sooner than that. Therefore we must make this configurable. If nothing
# is provided, we default to never expiring the metadata, as hardcoding
# some arbitrary does not seem very helpful.
repo.metadata_expire = desc.get("metadata_expire", "-1")
return repo