summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@vyatta.com>2010-05-28 09:54:15 -0700
committerAn-Cheng Huang <ancheng@vyatta.com>2010-05-28 09:54:15 -0700
commit5fcbd648e8c8c13f5b9db135d433db6a6bda5047 (patch)
treea53b977f05d6adbc9b3bf76680d98efef8871a87
parent7c7816b8d6217fbc9f8b26be092ae62b5acf8738 (diff)
parente9646c434de70ca36708ad2565941fdfa16d3c94 (diff)
downloadvyatta-cfg-5fcbd648e8c8c13f5b9db135d433db6a6bda5047.tar.gz
vyatta-cfg-5fcbd648e8c8c13f5b9db135d433db6a6bda5047.zip
Merge branch 'larkspur' of git.vyatta.com:/git/vyatta-cfg into larkspur
-rwxr-xr-xlib/Vyatta/Config.pm77
1 files changed, 61 insertions, 16 deletions
diff --git a/lib/Vyatta/Config.pm b/lib/Vyatta/Config.pm
index cc917b4..704e761 100755
--- a/lib/Vyatta/Config.pm
+++ b/lib/Vyatta/Config.pm
@@ -248,7 +248,12 @@ sub listOrigNodes {
$tmp =~ s/\n//g;
$tmp =~ s/%2F/\//g;
#print "DEBUG Vyatta::Config->listNodes(): node = $tmp\n";
- push @nodes_modified, $tmp;
+ my $ttmp = $self->{_current_dir_level} . "/" . $tmp;
+ $ttmp =~ s/\// /g;
+ my ($status, undef) = $self->getDeactivated($ttmp);
+ if (!defined($status) || $status eq 'active') {
+ push @nodes_modified, $tmp;
+ }
}
return @nodes_modified;
@@ -284,7 +289,12 @@ sub listOrigNodesNoDef {
$tmp =~ s/%2F/\//g;
#print "DEBUG Vyatta::Config->listNodes(): node = $tmp\n";
if ($tmp ne 'def') {
- push @nodes_modified, $tmp;
+ my $ttmp = $self->{_current_dir_level} . "/" . $tmp;
+ $ttmp =~ s/\// /g;
+ my ($status, undef) = $self->getDeactivated($ttmp);
+ if (!defined($status) || $status eq 'active') {
+ push @nodes_modified, $tmp;
+ }
}
}
@@ -324,14 +334,21 @@ sub returnValue {
$node =~ s/\//%2F/g;
$node =~ s/\s+/\//g;
- return unless
- open my $file, '<',
- "$self->{_new_config_dir_base}$self->{_current_dir_level}/$node/node.val";
-
- read $file, $tmp, 16384;
- close $file;
-
- $tmp =~ s/\n$//;
+ #getDeactivated
+ my $ttmp = $self->{_current_dir_level} . "/" . $node;
+ $ttmp =~ s/\// /g;
+ my ($status, undef) = $self->getDeactivated($ttmp);
+ #only return value if status is not disabled (i.e. local or both)
+ if (!defined($status) || $status eq 'active') {
+ return unless
+ open my $file, '<',
+ "$self->{_new_config_dir_base}$self->{_current_dir_level}/$node/node.val";
+
+ read $file, $tmp, 16384;
+ close $file;
+
+ $tmp =~ s/\n$//;
+ }
return $tmp;
}
@@ -410,14 +427,23 @@ sub returnOrigValue {
$node =~ s/\//%2F/g;
$node =~ s/\s+/\//g;
- my $filepath = "$self->{_active_dir_base}$self->{_current_dir_level}/$node";
- return unless open my $file, '<', "$filepath/node.val";
-
- read $file, $tmp, 16384;
- close $file;
- $tmp =~ s/\n$//;
+ #getDeactivated
+ my $ttmp = $self->{_current_dir_level} . "/" . $node;
+ $ttmp =~ s/\// /g;
+ my ($status, undef) = $self->getDeactivated($ttmp);
+ #only return value if status is not disabled (i.e. local or both)
+ if (!defined($status) || $status eq 'active') {
+ my $filepath = "$self->{_active_dir_base}$self->{_current_dir_level}/$node";
+
+ return unless open my $file, '<', "$filepath/node.val";
+
+ read $file, $tmp, 16384;
+ close $file;
+
+ $tmp =~ s/\n$//;
+ }
return $tmp;
}
@@ -522,6 +548,16 @@ sub existsOrig {
$node =~ s/\//%2F/g;
$node =~ s/\s+/\//g;
+ #getDeactivated()
+ my $ttmp = $self->{_current_dir_level} . "/" . $node;
+ $ttmp =~ s/\// /g;
+ my ($status, undef) = $self->getDeactivated($ttmp);
+ #only return value if status is not disabled (i.e. local or both)
+ if (defined($status)) { #if a .disable is in local or active or both then return false
+ return (1 != 1);
+ }
+
+
return ( -d "$self->{_active_dir_base}$self->{_current_dir_level}/$node" );
}
@@ -537,6 +573,15 @@ sub isDeleted {
my $filepathNew
= "$self->{_new_config_dir_base}$self->{_current_dir_level}/$node";
+ #getDeactivated()
+ my $ttmp = $self->{_current_dir_level} . "/" . $node;
+ $ttmp =~ s/\// /g;
+ my ($status, undef) = $self->getDeactivated($ttmp);
+ #only return value if status is not disabled (i.e. local or both)
+ if (defined($status) && $status eq 'local') {
+ return (-e $filepathAct);
+ }
+
return ((-e $filepathAct) && !(-e $filepathNew));
}