summaryrefslogtreecommitdiff
path: root/tools/run-centos
diff options
context:
space:
mode:
authorScott Moser <smoser@brickies.net>2017-10-23 14:11:38 -0400
committerScott Moser <smoser@brickies.net>2017-10-23 16:10:16 -0400
commit5b6fd3ae353dd65e57ab138d7dca640d1c88d32c (patch)
treebbc9b8fc973da1fbe5ce814336856df2e4fcd8d8 /tools/run-centos
parentc06eea972eb4b7bfa68f4f542f2fb67ea1d455ac (diff)
downloadvyos-cloud-init-5b6fd3ae353dd65e57ab138d7dca640d1c88d32c.tar.gz
vyos-cloud-init-5b6fd3ae353dd65e57ab138d7dca640d1c88d32c.zip
tools: make yum package installation more reliable
During continuous integration tests, we're seeing quite a lot of unreliablity when running 'yum install'. The change here is to move to re-trying a run of 'yum install --downloadonly' for 10 times or until it succeeds. Then afterwards, running yum install from the cache. This seems safer in general than just re-trying an install operation, since we are specifically affected by the download phase failing. Also present are some flake8 fixes to tools/read-dependencies.
Diffstat (limited to 'tools/run-centos')
-rwxr-xr-xtools/run-centos17
1 files changed, 16 insertions, 1 deletions
diff --git a/tools/run-centos b/tools/run-centos
index e87b2025..d58ef3e8 100755
--- a/tools/run-centos
+++ b/tools/run-centos
@@ -123,7 +123,22 @@ prep() {
return 0
fi
error "Installing prep packages: ${needed}"
- yum install --assumeyes ${needed}
+ set -- $needed
+ local n max r
+ n=0; max=10;
+ bcmd="yum install --downloadonly --assumeyes --setopt=keepcache=1"
+ while n=$(($n+1)); do
+ error ":: running $bcmd $* [$n/$max]"
+ $bcmd "$@"
+ r=$?
+ [ $r -eq 0 ] && break
+ [ $n -ge $max ] && { error "gave up on $bcmd"; exit $r; }
+ nap=$(($n*5))
+ error ":: failed [$r] ($n/$max). sleeping $nap."
+ sleep $nap
+ done
+ error ":: running yum install --cacheonly --assumeyes $*"
+ yum install --cacheonly --assumeyes "$@"
}
start_container() {