- Fixed config file parsing for null groups when a group

name was the same as an assignment immediately following
  it.
- Added support for undefined groups at the time of assignment.
  If a given group does not exist, an empty group will be
  created and a warning will be issued.
- Make method cleanupString() in SCST::SCST private.
- Minor updates.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@219 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Mark Buechler
2007-11-07 19:00:58 +00:00
parent 406a0dc9a6
commit ae6f85074d
2 changed files with 30 additions and 14 deletions

View File

@@ -1,7 +1,8 @@
package SCST::SCST;
# Author: Mark R. Buechler
# Copyright (c) 2005, 2006 Mark R. Buechler
# License: GPLv2
# Copyright (c) 2005-2007 Mark R. Buechler
use 5.005;
use IO::Handle;
@@ -54,7 +55,7 @@ $IOTYPE_PHYSICAL = 100;
$IOTYPE_VIRTUAL = 101;
$IOTYPE_PERFORMANCE = 102;
$VERSION = 0.7.2;
$VERSION = 0.7.3;
my $_SCST_MIN_MAJOR_ = 0;
my $_SCST_MIN_MINOR_ = 9;
@@ -389,10 +390,10 @@ sub handlerDevices {
$options = "";
}
$devices{$vname}->{'OPTIONS'} = $self->cleanupString($options);
$devices{$vname}->{'SIZE'} = $self->cleanupString($size);
$devices{$vname}->{'PATH'} = $self->cleanupString($path);
$devices{$vname}->{'BLOCKSIZE'} = $self->cleanupString($blocksize);
$devices{$vname}->{'OPTIONS'} = cleanupString($options);
$devices{$vname}->{'SIZE'} = cleanupString($size);
$devices{$vname}->{'PATH'} = cleanupString($path);
$devices{$vname}->{'BLOCKSIZE'} = cleanupString($blocksize);
}
close $io;
@@ -459,11 +460,11 @@ sub openDevice {
return 2;
}
$options = $self->cleanupString($options);
$options = cleanupString($options);
my $cmd = "open $device $path $blocksize $options\n";
$cmd = $self->cleanupString($cmd);
$cmd = cleanupString($cmd);
my $rc = $self->handler_private($handler_io, $cmd);
@@ -967,7 +968,6 @@ sub errorString {
}
sub cleanupString {
my $self = shift;
my $string = shift;
$string =~ s/^\s+//;

View File

@@ -1,9 +1,11 @@
#!/usr/bin/perl
$Version = 'SCST Configurator v0.7.1';
$Version = 'SCST Configurator v0.7.3';
# Configures SCST
#
# Written by Mark R. Buechler 12/07/04
# Author: Mark R. Buechler
# License: GPLv2
# Copyright (c) 2005-2007 Mark R. Buechler
sub usage
{
@@ -826,6 +828,18 @@ sub applyConfiguration {
# Assign new devices to groups..
foreach my $group (keys %used_assignments) {
if (!defined($GROUPS{$group})) {
# Looks like we're lacking a group. We'll create an empty one
print "\t-> WARNING: Auto-creating an empty group '$group' since none was configured.\n";
if (addGroup($group)) {
$errs++;
} else {
$changes++;
}
}
if (!defined($GROUPS{$group})) {
print "\t-> WARNING: Unable to assign to non-existant group '$group'.\n";
$errs += 1;
@@ -1392,13 +1406,15 @@ sub readConfig {
$line = cleanupString($line);
if ($line =~ /^\[(.*)\]$/) {
$last_arg = $arg;
$last_section = $section;
($section, $arg) = split(/\s+/, $1, 2);
if ($last_arg && ($last_arg ne $arg) && !$config{$last_section}->{$last_arg}) {
if ($last_arg && ($last_section ne $section) &&
!defined($config{$last_section}->{$last_arg})) {
$config{$last_section}->{$last_arg} = \%empty;
}
$last_arg = $arg;
$last_section = $section;
} elsif ($section && $arg && $line) {
my($parameter, $value) = split(/\s+/, $line, 2);