summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMichael Larson <slioch@slioch.vyatta.com>2010-06-07 17:47:34 -0700
committerMichael Larson <slioch@slioch.vyatta.com>2010-06-07 17:47:34 -0700
commit20740279ffcc5d8bec3126e05755043517dbe4f4 (patch)
tree29567a797ad070e3b406fd9d5101fbb06acde3aa /lib
parent5c274351b1f008e725ba5ebadee372bd2fe05824 (diff)
downloadvyatta-cfg-20740279ffcc5d8bec3126e05755043517dbe4f4.tar.gz
vyatta-cfg-20740279ffcc5d8bec3126e05755043517dbe4f4.zip
Additional apis missing support for deactivate node. problem was seen when reactivating bgp neighbor node.
Diffstat (limited to 'lib')
-rwxr-xr-xlib/Vyatta/Config.pm32
1 files changed, 27 insertions, 5 deletions
diff --git a/lib/Vyatta/Config.pm b/lib/Vyatta/Config.pm
index f3b1614..4ae578c 100755
--- a/lib/Vyatta/Config.pm
+++ b/lib/Vyatta/Config.pm
@@ -715,13 +715,21 @@ sub getDeactivated {
# will check the change_dir to see if the "node" has been changed from a previous
# value. returns true or false.
sub isChanged {
- my ($self, $node) = @_;
+ my ($self, $node, $disable) = @_;
# let's setup the filepath for the change_dir
$node =~ s/\//%2F/g;
$node =~ s/\s+/\//g;
my $filepath = "$self->{_changes_only_dir_base}$self->{_current_dir_level}/$node";
+ if (!defined $disable) {
+ my ($status,undef) = $self->getDeactivated($self->{_level}." ".$node);
+ if (defined $status && ($status eq 'active' || $status eq 'local')) {
+ return (defined $status);
+ }
+ }
+
+
# if the node exists in the change dir, it's modified.
return (-e $filepath);
}
@@ -729,7 +737,7 @@ sub isChanged {
## isChangedOrDeleted("node")
# is the "node" changed or deleted. node is relative. returns true or false
sub isChangedOrDeleted {
- my ($self, $node) = @_;
+ my ($self, $node, $disable) = @_;
$node =~ s/\//%2F/g;
$node =~ s/\s+/\//g;
@@ -745,6 +753,13 @@ sub isChangedOrDeleted {
my $filepathNew
= "$self->{_new_config_dir_base}$self->{_current_dir_level}/$node";
+ if (!defined $disable) {
+ my ($status,undef) = $self->getDeactivated($self->{_level}." ".$node);
+ if (defined $status && ($status eq 'active' || $status eq 'local')) {
+ return (defined $status);
+ }
+ }
+
return ((-e $filepathAct) && !(-e $filepathNew));
}
@@ -752,7 +767,7 @@ sub isChangedOrDeleted {
# will compare the new_config_dir to the active_dir to see if the "node" has
# been added. returns true or false.
sub isAdded {
- my ($self, $node) = @_;
+ my ($self, $node, $disable) = @_;
#print "DEBUG Vyatta::Config->isAdded(): node $node\n";
# let's setup the filepath for the modify dir
@@ -769,6 +784,13 @@ sub isAdded {
# now let's setup the path for the working dir
my $filepathActive = "$self->{_active_dir_base}$self->{_current_dir_level}/$node";
+ if (!defined $disable) {
+ my ($status,undef) = $self->getDeactivated($self->{_level}." ".$node);
+ if (defined $status && ($status eq 'active')) {
+ return (defined $status);
+ }
+ }
+
# if the node is in the active_dir it's not new
return (! -e $filepathActive);
}
@@ -802,8 +824,8 @@ sub listNodeStatus {
# No deleted nodes -- added, changed, ot static only.
if (defined $status && $status eq 'local') { $nodehash{$node} = "deleted"; }
elsif (defined $status && $status eq 'active') { $nodehash{$node} = "added"; }
- elsif ($self->isAdded($nodepath)) { $nodehash{$node} = "added"; }
- elsif ($self->isChanged($nodepath)) { $nodehash{$node} = "changed"; }
+ elsif ($self->isAdded($nodepath,'true')) { $nodehash{$node} = "added"; }
+ elsif ($self->isChanged($nodepath,'true')) { $nodehash{$node} = "changed"; }
else { $nodehash{$node} = "static"; }
}
}