From c075dc5298688065155e518b301ba9c3090fcd28 Mon Sep 17 00:00:00 2001 From: sakolish Date: Tue, 4 Mar 2008 20:01:02 +0000 Subject: [PATCH] Cleaned up error-handling (particularly for IVM) git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@671 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT-2.0/xCAT/PPCmac.pm | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/perl-xCAT-2.0/xCAT/PPCmac.pm b/perl-xCAT-2.0/xCAT/PPCmac.pm index 072193288..689ea7a33 100644 --- a/perl-xCAT-2.0/xCAT/PPCmac.pm +++ b/perl-xCAT-2.0/xCAT/PPCmac.pm @@ -226,10 +226,17 @@ sub ivm_getmacs { ####################################### # Get command exit code ####################################### - my $Rc = ( $? ) ? $? >> 8 : SUCCESS; - return( [$Rc,$result] ); -} + my $Rc = SUCCESS; + foreach ( split /\n/, $result ) { + if ( /^lpar_netboot: / ) { + $Rc = RC_ERROR; + last; + } + } + return( [$Rc,$result] ); + +} ########################################################################## @@ -273,7 +280,7 @@ sub getmacs { $opt ); } my $Rc = shift(@$result); - + ################################## # Form string from array results ################################## @@ -284,6 +291,9 @@ sub getmacs { # Return error ################################## if ( $Rc != SUCCESS ) { + if ( @$result[0] =~ /lpar_netboot: (.*)/ ) { + return( [[$name,$1]] ); + } return( [[$name,join( '', @$result )]] ); } ################################## @@ -309,9 +319,9 @@ sub getmacs { ##################################### my $values; foreach ( @$result ) { - if ( /^#\s*Type/ ) { + if ( /^#\s?Type/ ) { $values.= "\n$_\n"; - } elsif ( /^[^#]/ ) { + } elsif ( /^ent:?/ ) { $values.= "$_\n"; } } @@ -322,3 +332,4 @@ sub getmacs { 1; +