Ubuntu Pastebin

Paste from smoser at Mon, 23 Oct 2017 18:03:21 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
commit 5ebf52eb0a3911fdadde204845f60629d40fa411 (HEAD)
Author: Scott Moser <smoser@brickies.net>
Date:   Mon Oct 23 14:02:39 2017 -0400

    my-reliable-test

diff --git a/tools/read-dependencies b/tools/read-dependencies
index 2a648680..db944be3 100755
--- a/tools/read-dependencies
+++ b/tools/read-dependencies
@@ -30,9 +30,21 @@ DISTRO_PKG_TYPE_MAP = {
     'suse': 'suse'
 }
 
+MAYBE_RELIABLE_YUM_INSTALL = [
+   'sh', '-c',
+   'n=0; max=10;
+    while n=$(($n+1)) && ! yum makecache; do
+       r=$?
+       [ $n -ge $max ] && { echo "Gave up after $n tries [$r]"; exit 1; }
+       nap=$(($n*5))
+       echo "yum makecache try $n/$max failed [$r]. sleeping $nap"
+       sleep $nap
+    done
+    yum install --cacheonly --assumeyes "$@"', 'reliable-yum-install']
+
 DISTRO_INSTALL_PKG_CMD = {
-    'centos': ['yum', 'install', '--assumeyes'],
-    'redhat': ['yum', 'install', '--assumeyes'],
+    'centos': MAYBE_RELIABLE_YUM_INSTALL,
+    'redhat': MAYBE_RELIABLE_YUM_INSTALL,
     'debian': ['apt', 'install', '-y'],
     'ubuntu': ['apt', 'install', '-y'],
     'opensuse': ['zypper', 'install'],
Download as text