From cd8c5ff173d658875b05477890366555acb14c2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Georg=20Sch=C3=B6nberger?= Date: Fri, 28 Feb 2014 15:58:59 +0100 Subject: [PATCH] Replace old status checking lines --- check_lsi_raid | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/check_lsi_raid b/check_lsi_raid index 3865335..a6eec61 100755 --- a/check_lsi_raid +++ b/check_lsi_raid @@ -130,11 +130,9 @@ sub checkCommandStatus{ foreach my $line (@output){ if($line =~ /^Status/){ if($line eq "Status = Success\n"){ - print "true"; return 1; } else{ - print "false"; return 0; } } @@ -375,7 +373,7 @@ sub getLogicalDeviceStatus { $command .= " show $action"; my @output = `$command`; - if($output[1] eq "Status = Success\n") { + if(checkCommandStatus(\@output) { if($action eq "all") { my $output_dev = -1; my $flag = -1; @@ -474,7 +472,7 @@ sub getPhysDeviceStatus { $command .= " show $action"; my @output = `$command`; - if($output[1] eq "Status = Success\n") { + if(checkCommandStatus(\@output) { if($action eq "all") { my $output_enc = -1; my $output_dev = -1; @@ -668,7 +666,7 @@ sub getBBUStatus { my @output = `$command`; - if($output[1] eq "Status = Success\n") { + if(checkCommandStatus(\@output) { my $blockid = 0; foreach my $line (@output) { my $first; @@ -791,7 +789,7 @@ sub getCVStatus { my $statusMessage = ''; my @output = `$command`; - if($output[1] eq "Status = Success\n") { + if(checkCommandStatus(\@output) { my $currBlock; foreach my $line (@output) { if($line =~ /^(Cachevault_Info|Firmware_Status)/){ @@ -836,13 +834,13 @@ sub checkBBUorCVIsPresent{ my ($bbu,$cv); my $command = "$sudo $storcli /c$controller/bbu show"; my @output = `$command`; - if($output[1] eq "Status = Success\n") { + if(checkCommandStatus(\@output) { $bbu = 1; } else{$bbu = 0}; $command = "$sudo $storcli /c$controller/cv show"; @output = `$command`; - if($output[1] eq "Status = Success\n") { + if(checkCommandStatus(\@output) { $cv = 1; } else{$cv = 0};