-Fix problem where unresolvable BMC addresses reported as BUG rather than a clean error message

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@5206 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jbjohnso 2010-02-10 20:05:00 +00:00
parent 09172bd322
commit f49c63dcba
2 changed files with 17 additions and 7 deletions

View File

@ -66,7 +66,8 @@ sub new {
$self->{ipmi15only} = 1;
}
unless ($args{'bmc'} and defined $args{'userid'} and defined $args{'password'}) {
return (undef,"bmc, userid, and password must be specified");
$self->{error}="bmc, userid, and password must be specified";
return $self;
}
foreach (keys %args) { #store all passed parameters
$self->{$_} = $args{$_};
@ -78,7 +79,13 @@ sub new {
$socket = IO::Socket::INET->new(Proto => 'udp');
$select->add($socket);
}
$bmc_handlers{inet_ntoa(inet_aton($self->{bmc}))}=$self;
my $bmc_n;
unless ($bmc_n = inet_aton($self->{bmc})) {
$self->{error} = "Could not resolve ".$self->{bmc}." to an address";
return $self;
}
$bmc_handlers{inet_ntoa($bmc_n)}=$self;
$self->{peeraddr} = sockaddr_in($self->{port},inet_aton($self->{bmc}));
$self->{'sequencenumber'} = 0; #init sequence number
$self->{'sequencenumberbytes'} = [0,0,0,0]; #init sequence number

View File

@ -5435,13 +5435,16 @@ sub donode {
extraargs => \@exargs,
subcommand => $exargs[0],
};
my ($rc,@output) = ipmicmd($sessiondata{$node});
my @outhashes;
sendoutput($rc,@output);
yield;
if ($sessiondata{$node}->{ipmisession}->{error}) {
sendmsg([1,$sessiondata{$node}->{ipmisession}->{error}],$node);
} else {
my ($rc,@output) = ipmicmd($sessiondata{$node});
sendoutput($rc,@output);
yield;
return $rc;
}
#my $msgtoparent=freeze(\@outhashes);
# print $outfd $msgtoparent;
return $rc;
}
sub sendmsg {