summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-03-07 17:04:11 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-03-07 17:04:11 -0800
commit76e6a376c129e1df71d7eab7827b3e933dfec127 (patch)
tree1bc396d5b97a32f1b8d50b70dc8154dd694ccb9c
parentbbba2fa4a235d18a58cce2c618277b6194a03580 (diff)
downloadvyatta-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!
-rwxr-xr-xscripts/vyatta-qos.pl14
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);