From 0436bee24b3a34d4b3654b94b96159f3c3f3fd08 Mon Sep 17 00:00:00 2001 From: Michael Larson Date: Sat, 5 Jun 2010 20:03:10 -0700 Subject: fix for bug 5643. API changes missed exists(). flag check added. --- lib/Vyatta/Config.pm | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/lib/Vyatta/Config.pm b/lib/Vyatta/Config.pm index 93a2478..f3b1614 100755 --- a/lib/Vyatta/Config.pm +++ b/lib/Vyatta/Config.pm @@ -571,13 +571,22 @@ sub returnOrigValues { } ## exists("node") -# Returns true if the "node" exists. +# Returns true if the "node" exists. sub exists { - my ( $self, $node ) = @_; - $node =~ s/\//%2F/g; - $node =~ s/\s+/\//g; - - return ( -d "$self->{_new_config_dir_base}$self->{_current_dir_level}/$node" ); + my ( $self, $node, $disable ) = @_; + $node =~ s/\//%2F/g; + $node =~ s/\s+/\//g; + #getDeactivated() + my $ttmp = $self->{_current_dir_level} . "/" . $node; + $ttmp =~ s/\// /g; + if (!defined $disable) { + my ($status, undef) = $self->getDeactivated($ttmp); + #only return value if status is not disabled (i.e. local or both) + if (defined($status) && ($status eq 'both' || $status eq 'local')) { #if a .disable is in local or active or both then return false + return; + } + } + return ( -d "$self->{_new_config_dir_base}$self->{_current_dir_level}/$node" ); } ## existsOrig("node") -- cgit v1.2.3