Merge pull request #316 from Seneca-CDOT/issues/315-cachevaults-parsed-incorrectly

Fixed cachevaults and bbu parsing bug
main
Digimer 2 years ago committed by GitHub
commit af51edb97f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      Anvil/Tools/Words.pm
  2. 4
      scancore-agents/scan-storcli/scan-storcli

@ -192,6 +192,10 @@ Parameters;
This sets the string to be cleaned. If it is not passed in, or if the string is empty, then an empty string will be returned without error. This sets the string to be cleaned. If it is not passed in, or if the string is empty, then an empty string will be returned without error.
=head3 merge_spaces (optional)
This is a boolean value (0 or 1) that, if set, will merge multiple spaces into a single space. If not set, multiple spaces will be left as is. The default is '1'.
=cut =cut
sub clean_spaces sub clean_spaces
{ {
@ -203,10 +207,12 @@ sub clean_spaces
# Setup default values # Setup default values
my $string = defined $parameter->{string} ? $parameter->{string} : ""; my $string = defined $parameter->{string} ? $parameter->{string} : "";
$string =~ s/^\s+//; my $merge_spaces = defined $parameter->{merge_spaces} ? $parameter->{merge_spaces} : 1;
$string =~ s/\s+$//;
$string =~ s/\r//g; $string =~ s/^\s+//;
$string =~ s/\s+/ /g; $string =~ s/\s+$//;
$string =~ s/\r//g;
$string =~ s/\s+/ /g if $merge_spaces;
return($string); return($string);
} }

@ -8755,7 +8755,7 @@ sub get_bbu_data
}}); }});
foreach my $line (split/\n/, $output) foreach my $line (split/\n/, $output)
{ {
$line = $anvil->Words->clean_spaces({string => $line}); $line = $anvil->Words->clean_spaces({string => $line, merge_spaces => 0});
$line =~ s/\s+:/:/; $line =~ s/\s+:/:/;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { line => $line }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { line => $line }});
last if $line =~ /$adapter Failed /i; last if $line =~ /$adapter Failed /i;
@ -8987,7 +8987,7 @@ sub get_cachevault_data
}}); }});
foreach my $line (split/\n/, $output) foreach my $line (split/\n/, $output)
{ {
$line = $anvil->Words->clean_spaces({string => $line}); $line = $anvil->Words->clean_spaces({string => $line, merge_spaces => 0});
$line =~ s/\s+:/:/; $line =~ s/\s+:/:/;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { line => $line }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { line => $line }});
last if $line =~ /Cachevault doesn't exist/i; last if $line =~ /Cachevault doesn't exist/i;

Loading…
Cancel
Save