add sinv basic function working, needs work

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1993 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
lissav 2008-08-08 13:20:59 +00:00
parent f04e454432
commit dd99051b47

68
xCAT-client/bin/sinv Executable file
View File

@ -0,0 +1,68 @@
#!/usr/bin/env perl
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
BEGIN
{
$::XCATROOT =
$ENV{'XCATROOT'} ? $ENV{'XCATROOT'}
: -d '/opt/xcat' ? '/opt/xcat'
: '/usr';
}
use lib "$::XCATROOT/lib/perl";
use strict;
use File::Basename;
#use Data::Dumper;
use Getopt::Long;
use xCAT::MsgUtils;
use xCAT::Client;
use xCAT::SINV;
use xCAT::Utils;
my $bname = basename($0);
#-----------------------------------------------------------------------------
=head1 sinv
This program is the client interface for sinv, the software inventory routine.
sinv command
The sinv command is designed to check the configuration of nodes in a cluster. The command takes as input command line flags or a file. One or more templates will be compared against the output of a dsh command run on the nodes. The nodes will then be grouped according to the template they matched and a report returned to the administrator. Whether root is required, depends on the required permission on the command to run.
See man page for more information
=cut
#-----------------------------------------------------------------------------
# Main
my $cmdref;
my $rc = 0;
my $arg;
my @SaveARGV = @ARGV;
$cmdref->{command}->[0] = $bname; # save my command name
xCAT::SINV->parse_args; # parse the input, error, help or
# version will exit
my $arg = shift(@SaveARGV);
if ($arg =~ /^-/) # no noderange
{
xCAT::MsgUtils->message("I",
"Node range not specified, see sinv man page or sinv -h for syntax.\n");
exit 1;
}
else
{
$cmdref->{noderange}->[0] = $arg; # save noderange
@ARGV = @SaveARGV; # noderange removed for parsing
}
foreach (@SaveARGV)
{
push(@{$cmdref->{arg}}, $_);
}
xCAT::Client::submit_request($cmdref, \&xCAT::Client::handle_response);
exit $xCAT::Client::EXITCODE;