add: cni config removing

master
kvaps 2017-12-22 14:40:51 +01:00
parent 609881469a
commit 9dd2fce120
1 changed files with 4 additions and 1 deletions

View File

@ -73,7 +73,10 @@ random_gateway() {
}
unused_gateway() {
[ -f "$CNI_CONFIG" ] && local UNUSED_GATEWAY=$(sed -n 's/.*"gateway": "\(.*\)",/\1/p' "$CNI_CONFIG")
if [ -f "$CNI_CONFIG" ]; then
local UNUSED_GATEWAY=$(sed -n 's/.*"gateway": "\(.*\)",/\1/p' "$CNI_CONFIG")
rm -f "$CNI_CONFIG"
fi
if [ -z $UNUSED_GATEWAY ] || ! right_gateway "$UNUSED_GATEWAY"; then
UNUSED_GATEWAY="$(random_gateway)"
fi