Skip to content
Snippets Groups Projects
Commit fc1f20c6 authored by Gerhard Gonter's avatar Gerhard Gonter :speech_balloon:
Browse files

Multiple attributes (of logical devices) are rearranged into an array

reference when the second attribute with the same name is encountered.

Apparently, it is possible to have zero or even more than one physical
device as "Dedicated Hot-Spare", as documented in [1].  Maybe this is
the only attribute that can have multiple occurances.  This modification
now records multiple occurances as an array reference.

* [1] https://github.com/kumy/Parse-Arcconf/issues/4
parent 0db31af0
No related branches found
No related tags found
No related merge requests found
...@@ -206,7 +206,15 @@ sub parse_config_fh ...@@ -206,7 +206,15 @@ sub parse_config_fh
} elsif ($line =~ /^\s+([^:]+)\s+:\s+(.*)$/) { } elsif ($line =~ /^\s+([^:]+)\s+:\s+(.*)$/) {
my ($an, $av)= ($1, $2); my ($an, $av)= ($1, $2);
$an=~ s/\s*$//; $an=~ s/\s*$//;
$ctrl->{'logical drive'}{$current_logical_drive}{$an} = $av; if (exists($ctrl->{'logical drive'}{$current_logical_drive}{$an})) {
if (ref ($ctrl->{'logical drive'}{$current_logical_drive}{$an}) eq 'ARRAY') {
push (@{$ctrl->{'logical drive'}{$current_logical_drive}{$an}} => $av);
} else {
$ctrl->{'logical drive'}{$current_logical_drive}{$an} = [$ctrl->{'logical drive'}{$current_logical_drive}{$an}, $av];
}
} else {
$ctrl->{'logical drive'}{$current_logical_drive}{$an} = $av;
}
} elsif ($line =~ /^\s+-+$/) { } elsif ($line =~ /^\s+-+$/) {
my $cat = <$fh>; my $cat = <$fh>;
$cat =~ s/^\s+(\S.*\S+)\s+/$1/; $cat =~ s/^\s+(\S.*\S+)\s+/$1/;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment