diff --git a/scstadmin/SCST/SCST.pm b/scstadmin/SCST/SCST.pm index f591b598a..cd2162124 100644 --- a/scstadmin/SCST/SCST.pm +++ b/scstadmin/SCST/SCST.pm @@ -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+//; diff --git a/scstadmin/scstadmin b/scstadmin/scstadmin index 2e2dedb81..cc5e0e6b3 100755 --- a/scstadmin/scstadmin +++ b/scstadmin/scstadmin @@ -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);