Fix bug where nodeset install on a range would end up with a malformed state description

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@102 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jbjohnso 2007-11-29 21:57:24 +00:00
parent 3984f3f0a9
commit 05f5dbc5eb

View File

@ -45,6 +45,7 @@ sub setdestiny {
my $chaintab = xCAT::Table->new('chain');
my @nodes=@{$req->{node}};
my $state = $req->{arg}->[0];
my %nstates;
if ($state eq "next") {
return nextdestiny();
} elsif ($state =~ /^install$/ or $state eq "install" or $state eq "netboot") {
@ -54,15 +55,16 @@ sub setdestiny {
if ($errored) { return; }
my $nodetype = xCAT::Table->new('nodetype');
foreach (@{$req->{node}}) {
$nstates{$_} = $state; #local copy of state variable for mod
my $ntent = $nodetype->getNodeAttribs($_,[qw(os arch profile)]);
if ($ntent and $ntent->{os}) {
$state .= " ".$ntent->{os};
$nstates{$_} .= " ".$ntent->{os};
}
if ($ntent and $ntent->{arch}) {
$state .= "-".$ntent->{arch};
$nstates{$_} .= "-".$ntent->{arch};
}
if ($ntent and $ntent->{profile}) {
$state .= "-".$ntent->{profile};
$nstates{$_} .= "-".$ntent->{profile};
}
unless ($state =~ /^netboot/) { $chaintab->setNodeAttribs($_,{currchain=>"boot"}); };
}
@ -105,7 +107,11 @@ sub setdestiny {
return;
}
foreach (@nodes) {
$chaintab->setNodeAttribs($_,{currstate=>$state});
my $lstate = $state;
if ($nstates{$_}) {
$lstate = $nstates{$_};
}
$chaintab->setNodeAttribs($_,{currstate=>$lstate});
}
return getdestiny();
}