From 99828e03096a8e0ae237538f0aa266bdb495f257 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Mon, 14 Jul 2008 14:24:05 +0000 Subject: [PATCH] -Fix problem where file inclusion or parenthetical noderanges could induce a failure git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1876 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/NodeRange.pm | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/perl-xCAT/xCAT/NodeRange.pm b/perl-xCAT/xCAT/NodeRange.pm index 85871fd8a..4b7ab5a82 100644 --- a/perl-xCAT/xCAT/NodeRange.pm +++ b/perl-xCAT/xCAT/NodeRange.pm @@ -13,6 +13,7 @@ my $nodelist; #=xCAT::Table->new('nodelist',-create =>1); #my $nodeprefix = "node"; my @allnodeset; my $retaincache=0; +my $recurselevel=0; sub subnodes (\@@) { @@ -39,6 +40,7 @@ sub expandatom { } if ($atom =~ /^\(.*\)$/) { # handle parentheses by recursively calling noderange() $atom =~ s/^\((.*)\)$/$1/; + $recurselevel++; return noderange($atom); } @@ -240,6 +242,7 @@ sub noderange { $line =~ m/^([^: ]*)/; my $newrange = $1; chomp($newrange); + $recurselevel++; my @filenodes = noderange($newrange); foreach (@filenodes) { $nodes{$_}=1; @@ -277,9 +280,13 @@ sub noderange { delete $nodes{$_}; } } - unless ($retaincache) { - undef $nodelist; - @allnodeset=(); + if ($recurselevel) { + $recurselevel--; + } else { + unless ($retaincache) { + undef $nodelist; + @allnodeset=(); + } } return sort (keys %nodes);