scstadmin: Fix parsing names of multi-valued attributes

When defining e.g. more than ten CHAP users in scst.conf, scstadmin
only saves the first then CHAP users. Make sure that scstadmin saves
all information defined in sysfs.

Reported-by: Artur Piechocki <artur.piechocki@open-e.com>


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4928 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2013-07-30 10:49:02 +00:00
parent dfe644834c
commit 5d6b0142a8

View File

@@ -464,9 +464,9 @@ sub scstAttributes {
my $key = 0;
if ($is_key) {
if ($attribute =~ /.*(\d+)$/) {
$key = $1;
$attribute =~ s/\d+$//;
if ($attribute =~ /^([^\d]+)(\d+)$/) {
$attribute = $1;
$key = $2;
}
}
@@ -2655,9 +2655,9 @@ sub deviceAttributes {
my $key = 0;
if ($is_key) {
if ($attribute =~ /.*(\d+)$/) {
$key = $1;
$attribute =~ s/\d+$//;
if ($attribute =~ /^([^\d]+)(\d+)$/) {
$attribute = $1;
$key = $2;
}
}
@@ -2738,9 +2738,9 @@ sub driverAttributes {
my $key = 0;
if ($is_key) {
if ($attribute =~ /.*(\d+)$/) {
$key = $1;
$attribute =~ s/\d+$//;
if ($attribute =~ /^([^\d]+)(\d+)$/) {
$attribute = $1;
$key = $2;
}
}
@@ -2901,9 +2901,9 @@ sub targetAttributes {
my $key = 0;
if ($is_key) {
if ($attribute =~ /.*(\d+)$/) {
$key = $1;
$attribute =~ s/\d+$//;
if ($attribute =~ /^([^\d]+)(\d+)$/) {
$attribute = $1;
$key = $2;
}
}
@@ -3046,9 +3046,9 @@ sub groupAttributes {
my $key = 0;
if ($is_key) {
if ($attribute =~ /.*(\d+)$/) {
$key = $1;
$attribute =~ s/\d+$//;
if ($attribute =~ /^([^\d]+)(\d+)$/) {
$attribute = $1;
$key = $2;
}
}
@@ -3217,9 +3217,9 @@ sub lunAttributes {
my $key = 0;
if ($is_key) {
if ($attribute =~ /.*(\d+)$/) {
$key = $1;
$attribute =~ s/\d+$//;
if ($attribute =~ /^([^\d]+)(\d+)$/) {
$attribute = $1;
$key = $2;
}
}
@@ -3374,9 +3374,9 @@ sub initiatorAttributes {
my $key = 0;
if ($is_key) {
if ($attribute =~ /.*(\d+)$/) {
$key = $1;
$attribute =~ s/\d+$//;
if ($attribute =~ /^([^\d]+)(\d+)$/) {
$attribute = $1;
$key = $2;
}
}
@@ -3502,9 +3502,9 @@ sub deviceGroupAttributes {
my $key = 0;
if ($is_key) {
if ($attribute =~ /.*(\d+)$/) {
$key = $1;
$attribute =~ s/\d+$//;
if ($attribute =~ /^([^\d]+)(\d+)$/) {
$attribute = $1;
$key = $2;
}
}
@@ -3583,9 +3583,9 @@ sub targetGroupAttributes {
my $key = 0;
if ($is_key) {
if ($attribute =~ /.*(\d+)$/) {
$key = $1;
$attribute =~ s/\d+$//;
if ($attribute =~ /^([^\d]+)(\d+)$/) {
$attribute = $1;
$key = $2;
}
}
@@ -3675,9 +3675,9 @@ sub targetGroupTargetAttributes {
my $key = 0;
if ($is_key) {
if ($attribute =~ /.*(\d+)$/) {
$key = $1;
$attribute =~ s/\d+$//;
if ($attribute =~ /^([^\d]+)(\d+)$/) {
$attribute = $1;
$key = $2;
}
}
@@ -3954,9 +3954,9 @@ sub handlerAttributes {
my $key = 0;
if ($is_key) {
if ($attribute =~ /.*(\d+)$/) {
$key = $1;
$attribute =~ s/\d+$//;
if ($attribute =~ /^([^\d]+)(\d+)$/) {
$attribute = $1;
$key = $2;
}
}