summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorslioch <slioch@eng-140.vyatta.com>2009-07-01 10:31:07 -0700
committerAn-Cheng Huang <ancheng@vyatta.com>2009-07-08 16:54:54 -0700
commit7e5aa03f4b83a32f02fec6d55f6be71b3a608757 (patch)
tree0dd8cf892c38e5cc364df6f66b87f263b3e80559 /lib
parent2696aa8513b77f06152d3e54be86c3dea61d159b (diff)
downloadvyatta-cfg-7e5aa03f4b83a32f02fec6d55f6be71b3a608757.tar.gz
vyatta-cfg-7e5aa03f4b83a32f02fec6d55f6be71b3a608757.zip
added isActive function in perl code to allow a comparison of active
(active plus working commited) nodes for comparison. (cherry picked from commit a09624069795b49d12fd5d4be40dd2eb702b97a4)
Diffstat (limited to 'lib')
-rwxr-xr-xlib/Vyatta/Config.pm26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/Vyatta/Config.pm b/lib/Vyatta/Config.pm
index fd0222f..95c5636 100755
--- a/lib/Vyatta/Config.pm
+++ b/lib/Vyatta/Config.pm
@@ -98,6 +98,29 @@ sub listNodes {
return @nodes_modified;
}
+## isActive("path")
+# return true|false based on whether node path has
+# been processed or is active
+sub isActive {
+ my ($self, $path) = @_;
+ my @nodes = ();
+
+ my @comp_node = split " ", $path;
+
+ my $comp_node = $comp_node[-1];
+ if (!defined $comp_node) {
+ return 1;
+ }
+
+ my @nodes_modified = $self->listOrigPlusComNodes();
+ foreach my $node (@nodes_modified) {
+ if ($node eq $comp_node) {
+ return 0;
+ }
+ }
+ return 1;
+}
+
## listNodes("level")
# return array of all nodes (active plus currently committed) at "level"
# level is relative
@@ -113,6 +136,9 @@ sub listOrigPlusComNodes {
@coll{@nodes_modified} = @nodes_modified;
my $level = $self->{_level};
+ if (! defined $level) {
+ $level = "";
+ }
#now test against the inprocess file in the system
# my $com_file = "/tmp/.changes_$$";