modifying 'rscan -u' to append the 'groups' attribute rather than overwrite it

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@14456 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
zhaoertao 2012-11-28 08:12:19 +00:00
parent 71f63bf1dc
commit 0268c0c6a1

View File

@ -1610,10 +1610,23 @@ sub rscan {
my ($k3,$u3);
$k3->{node} = $name;
my $append;
if ($type eq "ppcblade") {
$u3->{groups} = "blade,all";
$append = "blade";
} else {
$u3->{groups} = $type.",all";
$append = $type;
}
$u3->{groups} = $append.",all";
my $tmp_groups = $db{nodelist}->getNodeAttribs($name,['groups']);
if (defined($tmp_groups) and defined($tmp_groups->{groups})) {
$u3->{groups} =$tmp_groups->{groups};
my @groups_array = split /,/,$tmp_groups->{groups};
if (!grep(/^$append$/, @groups_array)) {
$u3->{groups} .= ",$append";
}
if (!grep(/^all$/, @groups_array)) {
$u3->{groups} .= ",all";
}
}
$db{nodelist}->setAttribs($k3,$u3);
$db{nodelist}{commit} = 1;