pkgset: Fix meaning of retries

The name brings a different expectation than how it actually worked.
This patch makes the code work similarly to the expectation.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2021-02-23 13:52:15 +01:00
parent 5b5069175d
commit 735bfaa0d6
4 changed files with 11 additions and 11 deletions

View File

@ -581,16 +581,16 @@ Options
(for example) between composes, then Pungi may not respect those changes
in your new compose.
**signed_packages_retries** = 1
**signed_packages_retries** = 0
(*int*) -- In automated workflows a compose may start before signed
packages are written to disk. In such case it may make sense to wait for
the package to appear on storage. This option controls how many times to
try to look for the signed copy.
retry looking for the signed copy.
**signed_packages_wait** = 30
(*int*) -- Interval in seconds for how long to wait between attemts to find
signed packages. This option only makes sense when
``signed_packages_retries`` is set higher than to 1.
``signed_packages_retries`` is set higher than to 0.
Example

View File

@ -722,7 +722,7 @@ def make_schema():
"minItems": 1,
"default": [None],
},
"signed_packages_retries": {"type": "number", "default": 1},
"signed_packages_retries": {"type": "number", "default": 0},
"signed_packages_wait": {"type": "number", "default": 30},
"variants_file": {"$ref": "#/definitions/str_or_scm_dict"},
"comps_file": {"$ref": "#/definitions/str_or_scm_dict"},

View File

@ -333,7 +333,7 @@ class KojiPackageSet(PackageSetBase):
cache_region=None,
extra_builds=None,
extra_tasks=None,
signed_packages_retries=1,
signed_packages_retries=0,
signed_packages_wait=30,
):
"""
@ -515,8 +515,8 @@ class KojiPackageSet(PackageSetBase):
pathinfo = self.koji_wrapper.koji_module.pathinfo
paths = []
retries = self.signed_packages_retries
while retries > 0:
attempts_left = self.signed_packages_retries + 1
while attempts_left > 0:
for sigkey in self.sigkey_ordering:
if not sigkey:
# we're looking for *signed* copies here
@ -531,8 +531,8 @@ class KojiPackageSet(PackageSetBase):
return rpm_path
# No signed copy was found, wait a little and try again.
retries -= 1
if retries > 0:
attempts_left -= 1
if attempts_left > 0:
nvr = "%(name)s-%(version)s-%(release)s" % rpm_info
self.log_debug("Waiting for signed package to appear for %s", nvr)
time.sleep(self.signed_packages_wait)

View File

@ -323,7 +323,7 @@ class TestKojiPkgset(PkgsetCompareMixin, helpers.PungiTestCase):
self.koji_wrapper,
[fst_key, snd_key],
arches=["x86_64"],
signed_packages_retries=3,
signed_packages_retries=2,
signed_packages_wait=5,
)
@ -405,7 +405,7 @@ class TestKojiPkgset(PkgsetCompareMixin, helpers.PungiTestCase):
self.koji_wrapper,
["cafebabe"],
arches=["x86_64"],
signed_packages_retries=3,
signed_packages_retries=2,
signed_packages_wait=5,
)