summaryrefslogtreecommitdiff
path: root/lib/Vyatta/Config.pm
diff options
context:
space:
mode:
authorslioch <slioch@eng-140.vyatta.com>2009-07-02 09:48:10 -0700
committerAn-Cheng Huang <ancheng@vyatta.com>2009-07-08 16:54:54 -0700
commita29d676952c8150c97bfbc9e3fb1e7072c186e79 (patch)
tree4af25c5b64410b1b632c1360d22f173f5ff2a095 /lib/Vyatta/Config.pm
parent7e5aa03f4b83a32f02fec6d55f6be71b3a608757 (diff)
downloadvyatta-cfg-a29d676952c8150c97bfbc9e3fb1e7072c186e79.tar.gz
vyatta-cfg-a29d676952c8150c97bfbc9e3fb1e7072c186e79.zip
fixed isActive() api to now support mixed level and passed in relative path values.
(cherry picked from commit f6d95484a2f04633767409a565debe149ef5f56c)
Diffstat (limited to 'lib/Vyatta/Config.pm')
-rwxr-xr-xlib/Vyatta/Config.pm16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/Vyatta/Config.pm b/lib/Vyatta/Config.pm
index 95c5636..c97152c 100755
--- a/lib/Vyatta/Config.pm
+++ b/lib/Vyatta/Config.pm
@@ -107,12 +107,14 @@ sub isActive {
my @comp_node = split " ", $path;
- my $comp_node = $comp_node[-1];
+ my $comp_node = pop(@comp_node);
if (!defined $comp_node) {
return 1;
}
+
+ my $rel_path = join(" ",@comp_node);
- my @nodes_modified = $self->listOrigPlusComNodes();
+ my @nodes_modified = $self->listOrigPlusComNodes($rel_path);
foreach my $node (@nodes_modified) {
if ($node eq $comp_node) {
return 0;
@@ -128,7 +130,7 @@ sub listOrigPlusComNodes {
my ($self, $path) = @_;
my @nodes = ();
- my @nodes_modified = $self->listNodes();
+ my @nodes_modified = $self->listNodes($path);
#convert array to hash
my %coll;
@@ -151,6 +153,9 @@ sub listOrigPlusComNodes {
#$coll is of the form: blah
my $dir_path = $level;
+ if (defined $path) {
+ $dir_path .= " " . $path;
+ }
$dir_path =~ s/ /\//g;
$dir_path = "/".$dir_path;
@@ -169,8 +174,13 @@ sub listOrigPlusComNodes {
$tmp = $node[1];
}
+ if (!defined $tmp || $tmp eq '') {
+ next;
+ }
+
my @child = split "/",$tmp;
my $child;
+
# print("tmp: $tmp, $child[0], $child[1]\n");
if ($child[0] =~ /^\s*$/ || !defined $child[0] || $child[0] eq '') {
shift(@child);