From 7893bb54f3e0b5337de8a9cc305938b01d649edb Mon Sep 17 00:00:00 2001 From: Sergey Dolin Date: Wed, 2 Dec 2020 13:47:01 +0500 Subject: [PATCH] [ubuntu] Handle DNS error and errors in the child processes (#2146) --- images/linux/scripts/base/apt-mock.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/images/linux/scripts/base/apt-mock.sh b/images/linux/scripts/base/apt-mock.sh index 03936bd0c..d46a18780 100644 --- a/images/linux/scripts/base/apt-mock.sh +++ b/images/linux/scripts/base/apt-mock.sh @@ -13,11 +13,10 @@ i=1 while [ \$i -le 30 ];do err=\$(mktemp) $real_tool "\$@" 2>\$err - result=\$? - cat \$err >&2 - # no errors, continue - test \$result -eq 0 && break + # no errors, break the loop and continue normal flow + test -f \$err || break + cat \$err >&2 retry=false @@ -30,6 +29,9 @@ while [ \$i -le 30 ];do elif grep -q 'IPC connect call failed' \$err;then # the delay should help with gpg-agent not ready retry=true + elif grep -q 'Temporary failure in name resolution' \$err;then + # It looks like DNS is not updated with random generated hostname yet + retry=true fi rm \$err