diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-07-31 23:07:18 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-08-04 16:22:52 -0700 |
commit | a1360bf348660c1fe75823ee6d4386882f657eee (patch) | |
tree | ca73f6c2c0633004778503e94e043812c430669f /scripts/vyatta-bonding.pl | |
parent | 5d0843438caaf374b7f8ad7496ecf26f7523ab70 (diff) | |
download | vyatta-cfg-system-a1360bf348660c1fe75823ee6d4386882f657eee.tar.gz vyatta-cfg-system-a1360bf348660c1fe75823ee6d4386882f657eee.zip |
BONDING: fix error messages
Fix error messages that will only occur if template is using
script incorrectly.
Diffstat (limited to 'scripts/vyatta-bonding.pl')
-rwxr-xr-x | scripts/vyatta-bonding.pl | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/scripts/vyatta-bonding.pl b/scripts/vyatta-bonding.pl index b9ea0bcf..3012c5f9 100755 --- a/scripts/vyatta-bonding.pl +++ b/scripts/vyatta-bonding.pl @@ -73,9 +73,10 @@ sub get_slaves { sub add_slave { my ( $intf, $slave ) = @_; + my $sysfs_slaves = "/sys/class/net/$intf/bonding/slaves"; - open my $f, '>', "/sys/class/net/$intf/bonding/slaves" - or die "$intf is not a bonding interface"; + open my $f, '>', $sysfs_slaves + or die "Can't open $sysfs_slaves: $!"; print {$f} "+$slave\n"; close $f; @@ -83,9 +84,10 @@ sub add_slave { sub remove_slave { my ( $intf, $slave ) = @_; + my $sysfs_slaves = "/sys/class/net/$intf/bonding/slaves"; - open my $f, '>', "/sys/class/net/$intf/bonding/slaves" - or die "$intf is not a bonding interface"; + open my $f, '>', $sysfs_slaves + or die "Can't open $sysfs_slaves: $!"; print {$f} "-$slave\n"; close $f; @@ -170,8 +172,8 @@ sub add_port { sub usage { print "Usage: $0 --dev=bondX --mode={mode}\n"; - print " $0 --dev=bondX --add-port=ethX\n"; - print " $0 --dev=bondX --remove-port=ethX\n"; + print " $0 --dev=bondX --add=ethX\n"; + print " $0 --dev=bondX --remove=ethX\n"; print print "modes := ", join( ',', sort( keys %modes ) ), "\n"; exit 1; |