mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-08-27 09:06:39 +00:00
fix(confluent): configure nodes named explicitly without a console method
preprocess_request skips any node whose nodehm entry has neither cons nor serialport. That is the right default while scanning the whole table, but it also drops nodes the administrator named on the command line, leaving the dispatched node list empty. makeconfluentcfg then falls back to reading every node, so naming one console-less node quietly configures the whole cluster instead of the node that was asked for. A named node with no nodehm row at all is worse: both the selection here and the second lookup in makeconfluentcfg produce an undefined entry, which reaches confluent as an empty node name. Apply the skip only to the full table scan, and carry the node name through both lookups when the nodehm row is missing. Nodes without a console method are already handled downstream, where makeconfluentcfg keeps explicitly named entries and donodeent falls back to hardware management credentials. Co-authored-by: Jarrod Johnson <10814490+jjohnson42@users.noreply.github.com>
This commit is contained in:
@@ -114,6 +114,10 @@ sub preprocess_request {
|
||||
my $hmcache = $hmtab->getNodesAttribs($noderange, [ 'node', 'serialport', 'cons', 'conserver' ]);
|
||||
foreach my $node (@$noderange) {
|
||||
my $ent = $hmcache->{$node}->[0]; #$hmtab->getNodeAttribs($node,['node', 'serialport','cons', 'conserver']);
|
||||
#A node named on the command line may have no nodehm row at all. Carry
|
||||
#its name through anyway, otherwise the entry below is an undefined
|
||||
#reference and the node reaches confluent with an empty name.
|
||||
unless ($ent) { $ent = { node => $node }; }
|
||||
push @items, $ent;
|
||||
}
|
||||
} else {
|
||||
@@ -123,7 +127,11 @@ sub preprocess_request {
|
||||
|
||||
my @nodes = ();
|
||||
foreach (@items) {
|
||||
if (((!defined($_->{cons})) || ($_->{cons} eq "")) and !defined($_->{serialport})) { next; } #skip if 'cons' is not defined for this node, unless serialport suggests otherwise
|
||||
#skip if 'cons' is not defined for this node, unless serialport suggests otherwise.
|
||||
#This only applies while scanning every node in the table. A node named
|
||||
#explicitly on the command line was asked for by the administrator, so it is
|
||||
#configured whether or not it has a console method.
|
||||
if ($allnodes and ((!defined($_->{cons})) || ($_->{cons} eq "")) and !defined($_->{serialport})) { next; }
|
||||
if (defined($_->{conserver})) { push @{ $cons_hash{ $_->{conserver} }{nodes} }, $_->{node}; }
|
||||
else { push @{ $cons_hash{$master}{nodes} }, $_->{node}; }
|
||||
push @nodes, $_->{node};
|
||||
@@ -243,7 +251,13 @@ sub makeconfluentcfg {
|
||||
{
|
||||
foreach my $nodeent (keys %$ent)
|
||||
{
|
||||
push @tmpcfgents1, $ent->{$nodeent}->[0];
|
||||
#A named node may have no nodehm row, which leaves an undefined
|
||||
#entry that reaches confluent as an empty node name. The key here
|
||||
#is the node, so carry the name through instead.
|
||||
my $row = $ent->{$nodeent}->[0];
|
||||
$row = {} unless ($row);
|
||||
$row->{node} = $nodeent unless (defined($row->{node}));
|
||||
push @tmpcfgents1, $row;
|
||||
}
|
||||
}
|
||||
@cfgents1 = @tmpcfgents1;
|
||||
|
||||
Reference in New Issue
Block a user