Skip to content
Snippets Groups Projects
Commit e74ddf61 authored by Emil Obreshkov's avatar Emil Obreshkov
Browse files

Merge branch 'copy-rpm-eos-retry' into 'master'

RPM to EOS copy: 5 retries for mkdir and cp before counting failure as an error

See merge request atlas/athena!10083

Former-commit-id: 492b0b9a
parents 388d3e1b 10dd2ae9
No related branches found
No related tags found
No related merge requests found
...@@ -65,9 +65,25 @@ echo "=====================================================" ...@@ -65,9 +65,25 @@ echo "====================================================="
DESTDIR=${DESTDIR}/${BRANCH}/${ARCH}/${DDAY} DESTDIR=${DESTDIR}/${BRANCH}/${ARCH}/${DDAY}
_retry_() {
local cmd="$*" dt=16 retr=0
while ! $cmd ; do
if test $retr -ge 6 ; then
echo "ERROR: 6 retries of $cmd FAILED ... " >&2
return 1
fi
echo "WARNING: $cmd failed, waiting $dt sec ..."
sleep ${dt}s
dt=`expr $dt + $dt`
retr=`expr $retr + 1`
done
return 0
}
if [ ! -d ${DESTDIR} ] ; then if [ ! -d ${DESTDIR} ] ; then
echo "mkdir -p ${DESTDIR}" echo "mkdir -p ${DESTDIR}"
mkdir -p ${DESTDIR} _retry_ mkdir -p ${DESTDIR}
if [ ! -d ${DESTDIR} ] ; then ((ERROR_COUNT++)) ; fi #avoid false positive eos error if the directory was actually created if [ ! -d ${DESTDIR} ] ; then ((ERROR_COUNT++)) ; fi #avoid false positive eos error if the directory was actually created
fi fi
...@@ -79,7 +95,7 @@ if [ "${#arr_rpm[@]}" -le 0 ]; then ...@@ -79,7 +95,7 @@ if [ "${#arr_rpm[@]}" -le 0 ]; then
for ele in "${arr_rpm[@]}" for ele in "${arr_rpm[@]}"
do do
echo "Info: copying $ele to ${DESTDIR}" echo "Info: copying $ele to ${DESTDIR}"
cp -a $ele ${DESTDIR} || ((ERROR_COUNT++)) _retry_ cp -a $ele ${DESTDIR} || ((ERROR_COUNT++))
done done
fi fi
echo "=====================================================" echo "====================================================="
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment