From 4be828a2b3f2efe7efbbb02e326aca6bbb67e750 Mon Sep 17 00:00:00 2001 From: lissav Date: Mon, 20 Oct 2008 17:12:43 +0000 Subject: [PATCH] change to interface from xclientnrr git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2367 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/SINV.pm | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/perl-xCAT/xCAT/SINV.pm b/perl-xCAT/xCAT/SINV.pm index bccc3e496..1973ca025 100644 --- a/perl-xCAT/xCAT/SINV.pm +++ b/perl-xCAT/xCAT/SINV.pm @@ -18,6 +18,7 @@ the sinv command. package xCAT::SINV; use strict; use xCAT::MsgUtils; +use xCAT::NodeRange; use xCAT::Utils; use Fcntl qw(:flock); use Getopt::Long; @@ -73,10 +74,30 @@ sub usage #------------------------------------------------------------------------------ sub parse_and_run_sinv { - my ($class, $nodes, $args, $callback, $command, $noderange, $sub_req) = @_; + my ($class, $request, $callback, $sub_req) = @_; my $rsp = {}; $::CALLBACK = $callback; - @ARGV = @{$args}; # get argument + my $args = $request->{arg}; + @ARGV = @{$args}; # get arguments + my @noderange; + my $noderange = $ARGV[0]; + if ($noderange =~ /^-/) + { # no noderange, it is a flag + @noderange = "NO_NODE_RANGE"; + } + else + { # get noderange + @noderange = noderange($noderange); # expand noderange + my $tmp = shift(@ARGV); # shift the noderange from the args + if (nodesmissed) + { + my $rsp = {}; + $rsp->{data}->[0] = + "Invalid nodes in noderange:" . join(',', nodesmissed); + xCAT::MsgUtils->message("E", $rsp, $callback, 1); + return; + } + } my %options = (); $Getopt::Long::ignorecase = 0; #Checks case in GetOptions Getopt::Long::Configure("bundling"); @@ -143,14 +164,14 @@ sub parse_and_run_sinv # # get the node list # - if (!(@$nodes)) + if (!(@noderange)) { my $rsp = {}; $rsp->{data}->[0] = "No noderange specified on the command.\n"; xCAT::MsgUtils->message("E", $rsp, $callback); exit 1; } - my @nodelist = @$nodes; + my @nodelist = @noderange; # # Get Command to run