]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
hammer: added more retries in case of error in apt update
authorMichal Nowikowski <godfryd@isc.org>
Wed, 17 Apr 2019 04:44:17 +0000 (06:44 +0200)
committerMichal Nowikowski <godfryd@isc.org>
Thu, 16 May 2019 10:53:29 +0000 (12:53 +0200)
hammer.py

index 67562c681d58f3861b177d2295df4bb9e543ae0f..c1d85c440a833640b285d2385fa8c18481c615e6 100755 (executable)
--- a/hammer.py
+++ b/hammer.py
@@ -1477,10 +1477,12 @@ def _build_native_pkg(system, revision, features, tarball_path, env, check_times
         # install our freeradius-client but now from deb
         execute("echo 'deb %s kea main' | sudo tee /etc/apt/sources.list.d/isc.list" % repo_url)
         execute("sudo apt-key adv --fetch-keys %s/repository/repo-keys/repo-key.gpg" % repository_url)
-        _, out = execute('sudo apt update', capture=True)
-        if 'Bad header data' in out:
+        # try apt update for up to 10 times if there is an error
+        for _ in range(10):
+            _, out = execute('sudo apt update', capture=True)
+            if 'Bad header data' not in out:
+                break
             time.sleep(4)
-            execute('sudo apt update')
         install_pkgs('libfreeradius-client libfreeradius-client-dev', env=env, check_times=check_times)
 
         # unpack tarball