mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Updated all make_repo loops to use timeout value for retries
This commit is contained in:
parent
99554d9d72
commit
4bd47cc18a
1 changed files with 7 additions and 6 deletions
|
@ -590,6 +590,9 @@ def make_repo(repodir,
|
|||
# test if using older than gnupg 2.1, env file exists
|
||||
older_gnupg = __salt__['file.file_exists'](gpg_info_file)
|
||||
|
||||
# interval of 0.125 is really too fast on some systems
|
||||
interval = 0.5
|
||||
|
||||
if keyid is not None:
|
||||
with salt.utils.fopen(repoconfdist, 'a') as fow:
|
||||
fow.write('SignWith: {0}\n'.format(keyid))
|
||||
|
@ -654,8 +657,6 @@ def make_repo(repodir,
|
|||
break
|
||||
|
||||
## sign_it_here
|
||||
# interval of 0.125 is really too fast on some systems
|
||||
interval = 0.5
|
||||
for file in os.listdir(repodir):
|
||||
if file.endswith('.dsc'):
|
||||
abs_file = os.path.join(repodir, file)
|
||||
|
@ -722,7 +723,7 @@ def make_repo(repodir,
|
|||
cmd = 'reprepro --ignore=wrongdistribution --component=main -Vb . includedsc {0} {1}'.format(codename, abs_file)
|
||||
__salt__['cmd.run'](cmd, cwd=repodir, use_vt=True)
|
||||
else:
|
||||
number_retries = 5
|
||||
number_retries = timeout / interval
|
||||
times_looped = 0
|
||||
error_msg = 'Failed to reprepro includedsc file {0}'.format(abs_file)
|
||||
cmd = 'reprepro --ignore=wrongdistribution --component=main -Vb . includedsc {0} {1}'.format(codename, abs_file)
|
||||
|
@ -746,10 +747,10 @@ def make_repo(repodir,
|
|||
|
||||
if times_looped > number_retries:
|
||||
raise SaltInvocationError(
|
||||
'Attemping to reprepro includedsc for file {0} failed, timed out after {1} loops'.format(abs_file, times_looped)
|
||||
'Attemping to reprepro includedsc for file {0} failed, timed out after {1} loops'
|
||||
.format(abs_file, int(times_looped * interval))
|
||||
)
|
||||
# 0.125 is really too fast on some systems
|
||||
time.sleep(0.5)
|
||||
time.sleep(interval)
|
||||
|
||||
proc_exitstatus = proc.exitstatus
|
||||
if proc_exitstatus != 0:
|
||||
|
|
Loading…
Add table
Reference in a new issue