summaryrefslogtreecommitdiff
path: root/scripts/vyatta-qos.pl
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-06-15 11:34:44 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-06-15 11:34:44 -0700
commit39712bfaf390a4435218a14308cc6efa1a2d39b8 (patch)
treeacd9e4f34c3df83534b0de0125569a30555c8743 /scripts/vyatta-qos.pl
parent03579676efc28f43b35e1c4ca2624d565272ae46 (diff)
downloadvyatta-cfg-qos-39712bfaf390a4435218a14308cc6efa1a2d39b8.tar.gz
vyatta-cfg-qos-39712bfaf390a4435218a14308cc6efa1a2d39b8.zip
Fix update (apply-policy) at end
The $VAR(.) is not set on end node, so have to go hunting for policy type. Related to Bug 4545
Diffstat (limited to 'scripts/vyatta-qos.pl')
-rwxr-xr-xscripts/vyatta-qos.pl25
1 files changed, 14 insertions, 11 deletions
diff --git a/scripts/vyatta-qos.pl b/scripts/vyatta-qos.pl
index e0a1b0f..2576af1 100755
--- a/scripts/vyatta-qos.pl
+++ b/scripts/vyatta-qos.pl
@@ -228,17 +228,20 @@ sub create_policy {
# Configuration changed, reapply to all interfaces.
sub apply_policy {
- my ( $policy, $name ) = @_;
- my @usedby = interfaces_using($name);
-
- if (@usedby) {
- foreach my $args (@usedby) {
- update_interface( @$args );
+ while (my $name = shift) {
+ my @usedby = interfaces_using($name);
+ if (@usedby) {
+ foreach my $args (@usedby) {
+ update_interface( @$args );
+ }
+ } else {
+ # Recheck the policy, might have new errors.
+ my $policy = find_policy($name);
+ die "Unknown policy name $name\n" unless $policy;
+
+ my $shaper = make_policy( $policy, $name );
+ exit 1 unless $shaper;
}
- } else {
- # Recheck the policy, might have new errors.
- my $shaper = make_policy( $policy, $name );
- exit 1 unless $shaper;
}
}
@@ -272,7 +275,7 @@ GetOptions(
"list-policy=s" => \@listPolicy,
"delete-policy=s" => \@deletePolicy,
"create-policy=s{2}" => \@createPolicy,
- "apply-policy=s{2}" => \@applyPolicy,
+ "apply-policy=s" => \@applyPolicy,
) or usage();
delete_interface(@deleteInterface) if ( $#deleteInterface == 1 );