add a safeguard on the script

This commit is contained in:
Stavros kois
2022-11-15 12:28:35 +02:00
parent 83f9690c81
commit 20cf02b1b1
2 changed files with 8 additions and 2 deletions

View File

@@ -29,5 +29,8 @@ spec:
netmask=$(echo $netmask | grep -o -E '/.\d*')
netmask=${netmask#/}
echo "Matched routes to delete... {{ $ip }}/$netmask"
ip route del {{ $ip }}/$netmask || echo "Route deletion failed..."
# Don't try to delete routes if steps above didn't grep-ed anything
if [ ! "$netmask" == "" ]; then
ip route del {{ $ip }}/$netmask || echo "Route deletion failed..."
fi
echo "Routes deleted..."

View File

@@ -99,7 +99,10 @@ spec:
netmask=$(echo $netmask | grep -o -E '/.\d*')
netmask=${netmask#/}
echo "Matched routes to delete... {{ $ip }}/$netmask"
ip route del {{ $ip }}/$netmask || echo "Route deletion failed..."
# Don't try to delete routes if steps above didn't grep-ed anything
if [ ! "$netmask" == "" ]; then
ip route del {{ $ip }}/$netmask || echo "Route deletion failed..."
fi
echo "Routes deleted..."
{{ include "common.networking.dnsConfiguration" .Values | nindent 6 }}
volumes: {{ include "common.storage.configureAppVolumes" .Values | nindent 8 }}