summaryrefslogtreecommitdiff
path: root/scripts/vyatta-qos.pl
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2008-03-04 17:54:07 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2008-03-04 17:54:07 -0800
commit83ad4a2c13bf19ac18cf0bb2d386a01986ae5a7f (patch)
treeb0b0f0f07fd6c1421ac274d67fabe757604e8cc8 /scripts/vyatta-qos.pl
parent70d55c3c9e44ad501442ea879f4fdcba9c59963f (diff)
downloadvyatta-cfg-qos-83ad4a2c13bf19ac18cf0bb2d386a01986ae5a7f.tar.gz
vyatta-cfg-qos-83ad4a2c13bf19ac18cf0bb2d386a01986ae5a7f.zip
fix parsing problems during update
Fix parsing problems for update-interface that caused problems during boot. Bugfix: 2914
Diffstat (limited to 'scripts/vyatta-qos.pl')
-rwxr-xr-xscripts/vyatta-qos.pl21
1 files changed, 11 insertions, 10 deletions
diff --git a/scripts/vyatta-qos.pl b/scripts/vyatta-qos.pl
index db4d7bd..d5936f9 100755
--- a/scripts/vyatta-qos.pl
+++ b/scripts/vyatta-qos.pl
@@ -7,7 +7,6 @@ use strict;
use Getopt::Long;
-my $qosNode = 'qos-policy';
my $debug = $ENV{'QOS_DEBUG'};
my @updateInterface = ();
my @deleteInterface = ();
@@ -29,8 +28,9 @@ sub list_policy {
my $config = new VyattaConfig;
my @nodes = ();
- foreach my $type ($config->listNodes($qosNode) ) {
- foreach my $name ($config->listNodes("$qosNode $type") ) {
+ $config->setLevel('qos-policy');
+ foreach my $type ( $config->listNodes() ) {
+ foreach my $name ( $config->listNodes($type) ) {
push @nodes, $name;
}
}
@@ -57,9 +57,10 @@ sub update_interface {
( $direction eq "out" ) or die "Only out direction supported";
- foreach my $policy ( $config->listNodes($qosNode) ) {
- if ( $config->exists("$qosNode $policy $name") ) {
- $config->setLevel("$qosNode $policy $name");
+ $config->setLevel('qos-policy');
+ foreach my $policy ( $config->listNodes() ) {
+ if ( $config->exists("$policy $name") ) {
+ $config->setLevel("qos-policy $policy $name");
my $policy = VyattaQosPolicy->config( $config, $policy );
defined $policy or die "undefined policy";
@@ -88,7 +89,7 @@ sub update_interface {
}
}
- die "Unknown $qosNode $name\n";
+ die "Unknown qos-policy $name\n";
}
sub delete_policy {
@@ -97,7 +98,7 @@ sub delete_policy {
$config->setLevel("interfaces ethernet");
foreach my $interface ( $config->listNodes() ) {
- foreach my $direction ($config->listNodes("$interface qos-policy")) {
+ foreach my $direction ( $config->listNodes("$interface qos-policy") ) {
if ($config->returnValue("$interface qos-policy $direction") eq $name) {
# can't delete active policy
die "Qos policy $name still in use on ethernet $interface $direction\n";
@@ -111,8 +112,8 @@ sub update_policy {
my $config = new VyattaConfig;
$config->setLevel("interfaces ethernet");
- foreach my $interface ( $config->listNodes()) {
- foreach my $direction ($config->listNodes("$interface qos-policy")) {
+ foreach my $interface ( $config->listNodes() ) {
+ foreach my $direction ( $config->listNodes("$interface qos-policy") ) {
if ($config->returnValue("$interface qos-policy $direction") eq $name) {
delete_interface($interface, $direction);
update_interface($interface, $direction, $name);