diff options
author | slioch <slioch@eng-140.vyatta.com> | 2009-07-01 10:31:07 -0700 |
---|---|---|
committer | slioch <slioch@eng-140.vyatta.com> | 2009-07-01 10:31:07 -0700 |
commit | a09624069795b49d12fd5d4be40dd2eb702b97a4 (patch) | |
tree | ea337e8b833ef06a51fc9c9181b62e2c1ae6e22b /lib/Vyatta/Config.pm | |
parent | ee23c5da97e0f8e5cb89f088a6702a4a7449aee1 (diff) | |
download | vyatta-cfg-a09624069795b49d12fd5d4be40dd2eb702b97a4.tar.gz vyatta-cfg-a09624069795b49d12fd5d4be40dd2eb702b97a4.zip |
added isActive function in perl code to allow a comparison of active
(active plus working commited) nodes for comparison.
Diffstat (limited to 'lib/Vyatta/Config.pm')
-rwxr-xr-x | lib/Vyatta/Config.pm | 26 |
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_$$"; |