From f40de1d511ebe67b647f17fc1d56c5f4da5e3d76 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 7 May 2009 09:00:14 -0700 Subject: Convert template to non-expression create/update/delete New syntax is cleaner --- templates/system/gateway-address/node.def | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'templates/system/gateway-address/node.def') diff --git a/templates/system/gateway-address/node.def b/templates/system/gateway-address/node.def index 3a42a45e..f41a5212 100644 --- a/templates/system/gateway-address/node.def +++ b/templates/system/gateway-address/node.def @@ -1,9 +1,11 @@ type: ipv4 help: Set default gateway -create:expression: "vyatta-vtysh -c \"configure terminal\" -c \"ip route 0.0.0.0/0 $VAR(@)\" " -update:expression: "oldgw=`/opt/vyatta/sbin/vyatta-cli-expand-var.pl '$(/system/gateway-address/@)' ` && \ - vyatta-vtysh --noerror -c \"configure terminal\" -c \"no ip route 0.0.0.0/0 $oldgw \" && \ - vyatta-vtysh -c \"configure terminal\" -c \"ip route 0.0.0.0/0 $VAR(@)\" " -delete:expression: "if ${vyatta_sbindir}/vyatta-gateway-static_route-check.pl \"$VAR(@)\"; then \ - vyatta-vtysh -c \"configure terminal\" -c \"no ip route 0.0.0.0/0 $VAR(@)\"; fi" - +create: vyatta-vtysh -c "configure terminal" -c "ip route 0.0.0.0/0 $VAR(@)" +update: oldgw=`/opt/vyatta/sbin/vyatta-cli-expand-var.pl '$(/system/gateway-address/@)'` + if [ -n "$oldgw" ]; then + vyatta-vtysh --noerror -c "configure terminal" \ + -c "no ip route 0.0.0.0/0 $oldgw" + vyatta-vtysh -c "configure terminal" -c "ip route 0.0.0.0/0 $VAR(@)" +delete: if ${vyatta_sbindir}/vyatta-gateway-static_route-check.pl "$VAR(@)" + then vyatta-vtysh -c "configure terminal" -c "no ip route 0.0.0.0/0 $VAR(@)" + fi -- cgit v1.2.3