fix: introduced optional arg for clean_spaces

main
Deezzir 2 years ago
parent e49145efe1
commit deac1fc6a8
  1. 10
      Anvil/Tools/Words.pm
  2. 4
      scancore-agents/scan-storcli/scan-storcli

@ -203,10 +203,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