From 731a2b9a9d1dd36bef9949663bc3a23de1145c5e Mon Sep 17 00:00:00 2001 From: jjhua Date: Fri, 26 Oct 2012 06:26:12 +0000 Subject: [PATCH] fixed bug #3133. When some node don't exsit, there are some error msgs, and other nodes succeed. handle this case. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.7@14136 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/FSPvitals.pm | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/perl-xCAT/xCAT/FSPvitals.pm b/perl-xCAT/xCAT/FSPvitals.pm index 4a9f880a0..3506b1af4 100644 --- a/perl-xCAT/xCAT/FSPvitals.pm +++ b/perl-xCAT/xCAT/FSPvitals.pm @@ -69,21 +69,42 @@ sub enumerate_lcds { my $power_status_prefix = "Current Power Status:"; my $Rc; my @refcode; - my $c; + my $c = 0; my $values = xCAT::FSPUtils::fsp_api_action ($request, $name, $d, $action); $Rc = @$values[2]; my $data = @$values[1]; + my $t_n = @$values[0]; if( $Rc != 0 ) { - my @names = split(/,/, $name); - my @t_data = split(/\n\n/, $data); + my @names = split(/,/, $t_n); + my @t_data = split(/\n/, $data); foreach my $n (@names) { if( $data =~ /$n/ ) { chomp $t_data[$c]; - push @refcode,[$n, "$prefix $t_data[$c]", $Rc]; - if( $only_lcds == 0) { - push @refcode,[$n, "$power_status_prefix $t_data[$c]", $Rc]; - } + #push @refcode,[$n, "$prefix $t_data[$c]", $Rc]; + if($t_data[$c] =~ /Error/ ) { + if( $only_lcds == 0) { + push @refcode,[$n, "$power_status_prefix $t_data[$c]", $Rc]; + } + push @refcode,[$n, "$prefix $t_data[$c]", $Rc]; + } else { + if( $only_lcds == 0) { + + # get power status + if( $data =~ /1\|/) { + push @refcode, [$n, "$power_status_prefix on", $Rc] ; + } else { + push @refcode, [$n, "$power_status_prefix off", $Rc]; + } + } + + # get lcd value + if( $t_data[$c] =~ /1\|(\w[\w\s]*)/) { + push @refcode, [$n, "$prefix $1", $Rc] ; + } else { + push @refcode, [$n, "$prefix blank", $Rc]; + } + } $c++; } else { push @refcode, [$n, "$prefix $data", $Rc];