diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-03-07 17:04:11 -0800 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-03-07 17:04:11 -0800 |
commit | 76e6a376c129e1df71d7eab7827b3e933dfec127 (patch) | |
tree | 1bc396d5b97a32f1b8d50b70dc8154dd694ccb9c /scripts | |
parent | bbba2fa4a235d18a58cce2c618277b6194a03580 (diff) | |
download | vyatta-cfg-qos-76e6a376c129e1df71d7eab7827b3e933dfec127.tar.gz vyatta-cfg-qos-76e6a376c129e1df71d7eab7827b3e933dfec127.zip |
Fix problems caused by GetOptions() change.
When using closure form of GetOptions, any call to exit only
causes GetOptions error rather than exit of program. Since QoS
uses die to indicate transaction error, this doesn't work well!
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/vyatta-qos.pl | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/scripts/vyatta-qos.pl b/scripts/vyatta-qos.pl index 704b219..1182089 100755 --- a/scripts/vyatta-qos.pl +++ b/scripts/vyatta-qos.pl @@ -82,6 +82,7 @@ sub list_policy { } print join( ' ', @nodes ), "\n"; + exit 0; } ## delete_interface('eth0', 'out') @@ -292,6 +293,7 @@ sub delete_policy { # can't delete active policy die "Must delete QoS policy from interfaces before deleting rules\n"; } + exit 0; } sub check_conflict { @@ -360,10 +362,12 @@ my @updateInterface = (); my @deleteInterface = (); my @createPolicy = (); +my ($check, $apply, $start); + GetOptions( - "check" => sub { check_conflict(); }, - "apply" => sub { apply_changes(); }, - "start-interface=s" => sub { start_interface( $_[1] ); }, + "check" => \$check, + "apply" => \$apply, + "start-interface=s" => \$start, "update-interface=s{3}" => \@updateInterface, "delete-interface=s{2}" => \@deleteInterface, @@ -372,6 +376,10 @@ GetOptions( "create-policy=s{2}" => \@createPolicy, ) or usage(); +apply_changes() if $apply; +check_conflict() if $check; + delete_interface(@deleteInterface) if ( $#deleteInterface == 1 ); update_interface(@updateInterface) if ( $#updateInterface == 2 ); +start_interface( $start ) if $start; create_policy(@createPolicy) if ( $#createPolicy == 1); |