diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-06-03 16:25:24 -0700 |
---|---|---|
committer | An-Cheng Huang <ancheng@vyatta.com> | 2009-06-12 15:19:00 -0700 |
commit | b5253c5041a1fd0b45dbf992cb6c60df109d6927 (patch) | |
tree | 0148b0aab0d0ef79cecec31853ecf0db9674beb0 /templates | |
parent | 42745536c2c960c84e4d928b1a32dd350298bb16 (diff) | |
download | vyatta-cfg-b5253c5041a1fd0b45dbf992cb6c60df109d6927.tar.gz vyatta-cfg-b5253c5041a1fd0b45dbf992cb6c60df109d6927.zip |
Allow delete of ethernet settings when device does not exist
More bug 3952 fixes
(cherry picked from commit 2619f6c8fa01ab3ade6dfe6edb6815825c89cfd0)
Diffstat (limited to 'templates')
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 |