From 3c2487c2488314d565560dd3ca4882404820588b Mon Sep 17 00:00:00 2001 From: Claudio Pisa <claudio.pisa@garr.it> Date: Fri, 20 Dec 2019 11:54:34 +0000 Subject: [PATCH] Bugfix: two or more default routes with metric 0 This commit fixes the following bug: When two or more default routes with metric 0 where in place, the update-status hook fails to check that the default gateway is correctly set. --- hooks/update-status | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hooks/update-status b/hooks/update-status index 4b70664..737eb8f 100644 --- a/hooks/update-status +++ b/hooks/update-status @@ -18,7 +18,7 @@ GATEWAY_IP="$( echo "$GATEWAY" | awk -F "/" '{print $1}' )" DEFAULTROUTECOMMAND="$( getdefaultroutecommand )" -if eval $DEFAULTROUTECOMMAND | grep "\<${GATEWAY_IP}\>"; then +if [ $(eval $DEFAULTROUTECOMMAND | wc -l ) -eq 1 ] && eval $DEFAULTROUTECOMMAND | grep "\<${GATEWAY_IP}\>"; then juju-log "Default gateway looks OK. Doing nothing." exit 0 fi -- GitLab