summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-06-03 16:25:24 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-06-03 16:25:24 -0700
commit2619f6c8fa01ab3ade6dfe6edb6815825c89cfd0 (patch)
tree1ab7ed9d119588d4de8a47915961b22953a3c2a8 /templates
parentad4f2a101203e71076a3e23a0a2a093326927d45 (diff)
downloadvyatta-cfg-2619f6c8fa01ab3ade6dfe6edb6815825c89cfd0.tar.gz
vyatta-cfg-2619f6c8fa01ab3ade6dfe6edb6815825c89cfd0.zip
Allow delete of ethernet settings when device does not exist
More bug 3952 fixes
Diffstat (limited to 'templates')
-rw-r--r--templates/interfaces/ethernet/node.def3
-rw-r--r--templates/interfaces/ethernet/node.tag/disable/node.def7
-rw-r--r--templates/interfaces/ethernet/node.tag/mac/node.def3
-rw-r--r--templates/interfaces/ethernet/node.tag/mtu/node.def7
-rw-r--r--templates/interfaces/ethernet/node.tag/smp_affinity/node.def5
-rw-r--r--templates/interfaces/ethernet/node.tag/vif/node.def3
6 files changed, 17 insertions, 11 deletions
diff --git a/templates/interfaces/ethernet/node.def b/templates/interfaces/ethernet/node.def
index d4e86c4..e53bbdb 100644
--- a/templates/interfaces/ethernet/node.def
+++ b/templates/interfaces/ethernet/node.def
@@ -6,4 +6,5 @@ syntax:expression: exec \
allowed: /opt/vyatta/sbin/vyatta-interfaces.pl --show=ethernet
create: sudo ip link set "$VAR(@)" up
/opt/vyatta/sbin/vyatta-link-detect $VAR(@) on
-delete: sudo ip link set "$VAR(@)" down
+delete: [ -d /sys/class/net/$VAR(../@) ] || exit 0
+ sudo ip link set $VAR(@) down
diff --git a/templates/interfaces/ethernet/node.tag/disable/node.def b/templates/interfaces/ethernet/node.tag/disable/node.def
index ad03336..fbfb155 100644
--- a/templates/interfaces/ethernet/node.tag/disable/node.def
+++ b/templates/interfaces/ethernet/node.tag/disable/node.def
@@ -5,7 +5,8 @@ create: /etc/netplug/linkdown.d/dhclient $VAR(../@)
/etc/netplug/linkup.d/dhclient $VAR(../@)
exit 1
fi
-delete: if ! sudo ip link set $VAR(../@) up; then
- echo "Error enabling dev $VAR(../@)"
- exit 1
+delete: [ -d /sys/class/net/$VAR(../@) ] || exit 0
+ if ! sudo ip link set $VAR(../@) up; then
+ echo "Error enabling dev $VAR(../@)"
+ exit 1
fi
diff --git a/templates/interfaces/ethernet/node.tag/mac/node.def b/templates/interfaces/ethernet/node.tag/mac/node.def
index abafa7a..55264cf 100644
--- a/templates/interfaces/ethernet/node.tag/mac/node.def
+++ b/templates/interfaces/ethernet/node.tag/mac/node.def
@@ -3,5 +3,6 @@ help: Set the Media Access Control (MAC) address of this interface
syntax:expression: exec "\
/opt/vyatta/sbin/vyatta-interfaces.pl --dev $VAR(../@) --valid-mac $VAR(@)"
update: /opt/vyatta/sbin/vyatta-interfaces.pl --dev $VAR(../@) --set-mac $VAR(@)
-delete: /opt/vyatta/sbin/vyatta-interfaces.pl --dev $VAR(../@) --set-mac $VAR(../hw-id/@)
+delete: [ -d /sys/class/net/$VAR(../@) ] || exit 0
+ /opt/vyatta/sbin/vyatta-interfaces.pl --dev $VAR(../@) --set-mac $VAR(../hw-id/@)
diff --git a/templates/interfaces/ethernet/node.tag/mtu/node.def b/templates/interfaces/ethernet/node.tag/mtu/node.def
index 07c102a..dc03ae1 100644
--- a/templates/interfaces/ethernet/node.tag/mtu/node.def
+++ b/templates/interfaces/ethernet/node.tag/mtu/node.def
@@ -1,5 +1,8 @@
type: u32
help: Set the Maximum Transmission Unit (MTU) for this interface
syntax:expression: $VAR(@) >= 68 && $VAR(@) <= 9000; "MTU must be between 68 and 9000"
-update:expression: "sudo ip link set $VAR(../@) mtu $VAR(@)"; "Error setting MTU on dev $VAR(../@)"
-delete:expression: "sudo ip link set $VAR(../@) mtu 1500"; "Error deleting MTU on dev $VAR(../@)"
+update: if ! sudo ip link set $VAR(../@) mtu $VAR(@)
+ then echo "Error setting MTU on dev $VAR(../@)"; exit 1
+ fi
+delete: [ -d /sys/class/net/$VAR(../@) ] || exit 0
+ sudo ip link set $VAR(../@) mtu 1500
diff --git a/templates/interfaces/ethernet/node.tag/smp_affinity/node.def b/templates/interfaces/ethernet/node.tag/smp_affinity/node.def
index 9d5d289..c07fa1d 100644
--- a/templates/interfaces/ethernet/node.tag/smp_affinity/node.def
+++ b/templates/interfaces/ethernet/node.tag/smp_affinity/node.def
@@ -24,9 +24,8 @@ update:
exit 1
fi
-delete:
- sudo /opt/vyatta/sbin/vyatta-irqaffin reset $VAR(../@)
- if [ $? -ne 0 ]; then
+delete: [ -d /sys/class/net/$VAR(../@) ] || exit 0
+ if ! sudo /opt/vyatta/sbin/vyatta-irqaffin reset $VAR(../@); then
echo "Error deleting CPU affinity mask on interface $VAR(../@)"
exit 1
fi
diff --git a/templates/interfaces/ethernet/node.tag/vif/node.def b/templates/interfaces/ethernet/node.tag/vif/node.def
index dabfa56..4cb0639 100644
--- a/templates/interfaces/ethernet/node.tag/vif/node.def
+++ b/templates/interfaces/ethernet/node.tag/vif/node.def
@@ -11,6 +11,7 @@ create: if ! sudo ip link add link $VAR(../@) name "$VAR(../@).$VAR(@)" type vla
sudo ip link set "$VAR(../@).$VAR(@)" up
fi
/opt/vyatta/sbin/vyatta-link-detect "$VAR(../@).$VAR(@)" on
-delete: sudo ip link delete dev "$VAR(../@).$VAR(@)" type vlan id $VAR(@)
+delete: [ -d /sys/class/net/$VAR(../@) ] || exit 0
+ sudo ip link delete dev "$VAR(../@).$VAR(@)" type vlan id $VAR(@)
comp_help: possible completions:
<0-4094> Set VLAN ID