defect 4147 - fix prescripts preprocess_request to only process nodes that have prescripts defined
This commit is contained in:
parent
c4b71ab3d9
commit
cd96e91c11
@ -46,8 +46,39 @@ sub preprocess_request
|
||||
#if already preprocessed, go straight to request
|
||||
if ($req->{_xcatpreprocessed}->[0] == 1) { return [$req]; }
|
||||
|
||||
my $nodes = $req->{node};
|
||||
if (!$nodes) { return;}
|
||||
my $req_nodes = $req->{node};
|
||||
if (!$req_nodes) { return;}
|
||||
|
||||
my @nodes;
|
||||
my $command = $req->{command}->[0];
|
||||
my $column;
|
||||
if ($command eq 'runbeginpre') { $column = 'begin'; }
|
||||
elsif ($command eq 'runendpre') { $column = 'end'; }
|
||||
else { $column = ''; }
|
||||
|
||||
# See if anything in the prescripts table for the nodes. If not, skip.
|
||||
# Nothing to do.
|
||||
my $tab = xCAT::Table->new('prescripts');
|
||||
#first check if xcatdefaults entry
|
||||
if ( $tab->getAttribs({node=>"xcatdefaults"},$column) ) {
|
||||
# yes - process all nodes
|
||||
@nodes = @$req_nodes;
|
||||
} else {
|
||||
# no xcatdefaults, check for node entries
|
||||
my $tabdata=$tab->getNodesAttribs($req_nodes,['node', $column]);
|
||||
if ($tabdata) {
|
||||
foreach my $node (@$req_nodes) {
|
||||
if (($tabdata->{$node}) &&
|
||||
($tabdata->{$node}->[0]) &&
|
||||
($tabdata->{$node}->[0]->{$column}) ) {
|
||||
push (@nodes,$node);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# if no nodes left to process, we are done
|
||||
if (! @nodes) { return; }
|
||||
|
||||
my $service = "xcat";
|
||||
my @args=();
|
||||
|
Loading…
Reference in New Issue
Block a user