From fcb7fbc55ddab8b9e3712cae0c2b91c961a415c7 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Mon, 31 Mar 2008 20:15:15 +0000 Subject: [PATCH] -Provide more informative errors when fairly egregious resolution or table problems occur git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@954 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server-2.0/lib/xcat/plugins/bmcconfig.pm | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/xCAT-server-2.0/lib/xcat/plugins/bmcconfig.pm b/xCAT-server-2.0/lib/xcat/plugins/bmcconfig.pm index ba64be681..a4f17af21 100644 --- a/xCAT-server-2.0/lib/xcat/plugins/bmcconfig.pm +++ b/xCAT-server-2.0/lib/xcat/plugins/bmcconfig.pm @@ -2,6 +2,7 @@ package xCAT_plugin::bmcconfig; use Data::Dumper; use xCAT::Table; +use xCAT::MsgUtils; use Socket; sub handled_commands { @@ -23,7 +24,12 @@ sub genpassword { sub net_parms { my $ip = shift; - $ip = inet_ntoa(inet_aton($ip)); + if (inet_aton($ip)) { + $ip = inet_ntoa(inet_aton($ip)); + } else { + xCAT::MsgUtils->message("S","Unable to resolve $ip"); + return undef; + } my $nettab = xCAT::Table->new('networks'); unless ($nettab) { return undef }; my @nets = $nettab->getAllAttribs('net','mask','gateway'); @@ -41,7 +47,7 @@ sub net_parms { return ($ip,$mask,$gw); } } - syslog("local1|err","xCAT BMC configuration error, no appropriate network for $ip found in networks, unable to determine netmask"); + xCAT::MsgUtils->message("S","xCAT BMC configuration error, no appropriate network for $ip found in networks, unable to determine netmask"); } @@ -84,6 +90,11 @@ sub process_request { if ($tmphash->{username}) { $username = $tmphash->{username}; } + unless (defined $bmc) { + xCAT::MsgUtils->message('S',"Unable to identify bmc for $node, refusing to give config data"); + $callback->({error=>["Invalid table configuration for bmcconfig"],errorcode=>[1]}); + return 1; + } (my $ip,my $mask,my $gw) = net_parms($bmc); my $response={bmcip=>$ip,netmask=>$mask,gateway=>$gw,username=>$username,password=>$password}; $callback->($response);