bug 2810670: defrm foreach logic error fix

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3616 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
ligc 2009-06-23 05:22:57 +00:00
parent 87fbe622ce
commit 7c6c9a1706

View File

@ -2837,6 +2837,12 @@ sub defrm
next;
}
# Dynamic node group stores in nodegroup table
# do not need to update the nodelist table
if ($grphash{$obj}{'grouptype'} eq 'dynamic')
{
next;
}
# get the members list
# all groups are "static" for now
$grphash{$obj}{'grouptype'} = "static";
@ -2849,21 +2855,25 @@ sub defrm
my @gprslist;
foreach my $m (@members)
{
# need to update the "groups" attr of the node def
# get the def of this node
$nhash{$m} = 'node';
}
# Performance: Only call getobjdefs once
%nodehash = xCAT::DBobjUtils->getobjdefs(\%nhash);
if (!defined(%nodehash))
{
my $rsp;
my @nodes = keys %nhash;
my $m = join ',', @nodes;
$rsp->{data}->[0] =
"Could not get xCAT object definition for \'$m\'.";
xCAT::MsgUtils->message("I", $rsp, $::callback);
next;
}
foreach my $m (keys %nodehash)
{
# need to update the "groups" attr of the node def
# split the "groups" to get a list
@gprslist = split(',', $nodehash{$m}{groups});