Subject: | Parsing error with newer hpacucli version |
Date: | Fri, 23 Aug 2013 13:11:10 -0400 |
To: | bug-Parse-HP-ACU [...] rt.cpan.org |
From: | Milos Vyletel <milos.vyletel [...] gmail.com> |
In recent versions of hpacucli output was slightly changed which confuses
this parser.
Lines similar to
SEP (Vendor ID PMCSIERA, Model SRCv8x6G) 380
Device Number: 380
Firmware Version: RevB
WWID: 5001438007B0E297
Vendor ID: PMCSIERA
Model: SRCv8x6G
were added and if we have server with more than one controller some
controllers can
have wrong firmware version in resulting hash. We will simply ignore this
new additions
since they are more than useless for us.
diff -up Parse-HP-ACU-0.03/lib/Parse/HP/ACU.pm.orig
Parse-HP-ACU-0.03/lib/Parse/HP/ACU.pm
--- Parse-HP-ACU-0.03/lib/Parse/HP/ACU.pm.orig 2013-08-14
10:16:26.169516909 -0400
+++ Parse-HP-ACU-0.03/lib/Parse/HP/ACU.pm 2013-08-14 10:24:51.251641566
-0400
@@ -140,6 +140,7 @@ sub parse_config_fh
my $current_logical_drive = undef;
my $current_mirror_group = undef;
my $current_physical_drive = undef;
+ my $ignore_sep_block = 0;
LINE: while(my $line = <$fh>)
{
@@ -154,6 +155,7 @@ sub parse_config_fh
$current_logical_drive = undef;
$current_mirror_group = undef;
$current_physical_drive = undef;
+ $ignore_sep_block = 0;
$controller->{$current_controller} = {};
$controller->{$current_controller}
->{'description'} = $line;
@@ -162,6 +164,9 @@ sub parse_config_fh
next if(!defined($current_controller));
+ $ignore_sep_block = 1 if($line =~ /SEP/);
+ next if($ignore_sep_block);
+
$line =~ s/^\s+//g;
$line =~ s/\s+$//g;
$line =~ s/[ ]+/ /g;