]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
hammer: hardened vagrant upload, tuned timeouts
authorMichal Nowikowski <godfryd@isc.org>
Thu, 24 Jan 2019 14:32:03 +0000 (15:32 +0100)
committerMichal Nowikowski <godfryd@isc.org>
Thu, 31 Jan 2019 13:56:46 +0000 (14:56 +0100)
hammer.py

index 91781e08d0adeeaf88f4e6369e19db834da3b04c..d9dca99c209b51eb31ac5f7a2c98e12a69492604 100755 (executable)
--- a/hammer.py
+++ b/hammer.py
@@ -279,6 +279,18 @@ class VagrantEnv(object):
             execute('tar -czf %s ./*' % box_path, cwd=lxc_box_dir)
             execute('sudo rm -rf %s' % lxc_box_dir)
 
+    def upload(self, src):
+        attempt = 4
+        while attempt > 0:
+            exitcode = execute('vagrant upload %s' % src, cwd=self.vagrant_dir, dry_run=self.dry_run, raise_error=False)
+            if exitcode == 0:
+                break
+            attempt -= 1
+        if exitcode != 0:
+            msg = 'cannot upload %s' % src
+            log.error(msg)
+            raise ExecutionError(msg)
+
     def run_build_and_test(self, tarball_path, jobs):
         if self.dry_run:
             return 0, 0
@@ -290,7 +302,7 @@ class VagrantEnv(object):
             cmd += ' -zcf /tmp/%s.tar.gz .' % name_ver
             execute(cmd)
             tarball_path = '/tmp/%s.tar.gz' % name_ver
-        execute('vagrant upload %s %s.tar.gz' % (tarball_path, name_ver), cwd=self.vagrant_dir)
+        self.upload(tarball_path)
 
         log_file_path = os.path.join(self.vagrant_dir, 'build.log')
         log.info('Build log file stored to %s', log_file_path)
@@ -391,7 +403,7 @@ class VagrantEnv(object):
                 self.execute("sudo dnf install -y python36")
 
         hmr_py_path = os.path.join(self.repo_dir, 'hammer.py')
-        execute('vagrant upload %s' % hmr_py_path, cwd=self.vagrant_dir, dry_run=self.dry_run)
+        self.upload(hmr_py_path)
 
         log_file_path = os.path.join(self.vagrant_dir, 'prepare.log')
         log.info('Prepare log file stored to %s', log_file_path)
@@ -599,7 +611,7 @@ def prepare_deps_local(features, check_times):
             execute('rm -rf rpmbuild')
             execute('wget --no-verbose -O srpms/log4cplus-1.1.3-0.4.rc3.el7.src.rpm https://rpmfind.net/linux/epel/7/SRPMS/Packages/l/log4cplus-1.1.3-0.4.rc3.el7.src.rpm',
                     check_times=check_times)
-            execute('rpmbuild --rebuild srpms/log4cplus-1.1.3-0.4.rc3.el7.src.rpm', env=env, check_times=check_times)
+            execute('rpmbuild --rebuild srpms/log4cplus-1.1.3-0.4.rc3.el7.src.rpm', env=env, timeout=120, check_times=check_times)
             execute('sudo rpm -i rpmbuild/RPMS/x86_64/log4cplus-1.1.3-0.4.rc3.el8.x86_64.rpm', env=env, check_times=check_times)
             execute('sudo rpm -i rpmbuild/RPMS/x86_64/log4cplus-devel-1.1.3-0.4.rc3.el8.x86_64.rpm', env=env, check_times=check_times)
 
@@ -708,6 +720,8 @@ def prepare_deps_local(features, check_times):
 
     #execute('sudo rm -rf /usr/share/doc')
 
+    log.info('Preparing deps completed successfully.')
+
 
 def build_local(features, tarball_path, check_times, jobs):
     env = os.environ.copy()