scstadmin: Add the -dumpAttrs command line option

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7321 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2018-01-04 04:15:11 +00:00
parent 6aaefd6882
commit a8f0afeb50

View File

@@ -259,6 +259,7 @@ BEGIN {
}
use SCST::SCST 1.0.0;
use Data::Dumper;
use Getopt::Long;
use IO::File;
use IO::Dir;
@@ -383,6 +384,7 @@ sub getArgs {
my $show_usage;
my $nonkey;
my $force;
my $dumpAttrs;
my $p = new Getopt::Long::Parser;
@@ -483,6 +485,7 @@ sub getArgs {
'noprompt' => \$_NOPROMPT_,
'cont_on_err' => \$_CONT_ON_ERR_,
'force' => \$force,
'dumpAttrs' => \$dumpAttrs,
'debug' => \$_DEBUG_))
{
exit 1;
@@ -823,6 +826,7 @@ sub getArgs {
nonkey => $nonkey,
force => $force,
dumpAttrs => $dumpAttrs,
);
return \%args;
}
@@ -932,6 +936,7 @@ sub main {
my $nonkey = $args->{nonkey};
my $force = $args->{force};
my $dumpAttrs = $args->{dumpAttrs};
$SCST = new SCST::SCST($_DEBUG_);
@@ -1326,6 +1331,18 @@ sub main {
print "\t-> Done.\n";
last SWITCH;
};
defined($dumpAttrs) && do {
print "SCST attributes:\n";
print Dumper($SCST->scstAttributes());
foreach my $handler (sort keys %{$CURRENT{'handler'}}) {
my $devices = $CURRENT{'handler'}->{$handler};
foreach my $device (sort @{$devices}) {
print "Device $device attributes:\n";
print Dumper($SCST->deviceAttributes($device));
}
}
last SWITCH;
};
if (!$all_good) {
print "No valid operations specified.\n";