From abf34b0acb3f3c50067d0c1182c7d5fc0b054df9 Mon Sep 17 00:00:00 2001 From: yinle Date: Sat, 15 Jan 2011 07:07:07 +0000 Subject: [PATCH] FSP/BPA redundancy: add some checking of getNodeIPaddress git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8670 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/Utils.pm | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index 3a5d780f1..ec8255a2b 100644 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -2868,11 +2868,16 @@ sub getNodeIPaddress push (@nonip, $_); } } - my $hstab = xCAT::Table->new('hosts'); - if ( $hstab ) { - my $ent = $hstab->getNodesAttribs(\@nonip,['ip']); - foreach ( @nonip) { - push (@myip, $_); + if (scalar(@nonip)){ + my $hstab = xCAT::Table->new('hosts'); + if ( $hstab ) { + my $ent = $hstab->getNodesAttribs(\@nonip,['ip']); + if ($ent){ + foreach (@nonip) { + my $i = $ent->{$_}->[0]->{ip}; + push (@myip, $i); + } + } } } $ips = join ",", @myip;