From a3eb857c88b25a869377feadf92ebfe7e8ce5268 Mon Sep 17 00:00:00 2001 From: yinle Date: Fri, 4 Mar 2011 02:03:58 +0000 Subject: [PATCH] modify the command processing of lsslp to support allowing user to input noderange git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8987 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-client/bin/lsslp | 53 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 xCAT-client/bin/lsslp diff --git a/xCAT-client/bin/lsslp b/xCAT-client/bin/lsslp new file mode 100644 index 000000000..51b6240c4 --- /dev/null +++ b/xCAT-client/bin/lsslp @@ -0,0 +1,53 @@ +#!/usr/bin/env perl +# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html + +# Used as a standard client cmd that can be used for xcat cmds that do not have +# noderange as an argument. See xcatclient for additional documentation. + +# To use this, sym link your cmd name to this script. + +BEGIN { $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/opt/xcat' : '/usr'; } +use lib "$::XCATROOT/lib/perl"; +use Cwd; +use File::Basename; +use xCAT::Client; + +my $bname = basename($0); +my $cmdref; +if ($bname =~ /xcatclientnnr/) { $cmdref->{command}->[0]=shift @ARGV; } # xcatclientnnr was invoked directly and the 1st arg is cmd name that is used to locate the plugin +else { $cmdref->{command}->[0] = $bname; } # the cmd was sym linked to xcatclientnnr +$cmdref->{cwd}->[0] = cwd(); + +if (-p STDIN) { + my $data; + while ( ) { $data.=$_; } + $cmdref->{stdin}->[0]=$data; +} + + +my @tmpargv = @ARGV; +foreach (@tmpargv) +{ + if (($_ =~ /^(\d+)/ ) || ($_ =~ /^(\w+)/ )) + { + $cmdref->{noderange}->[0]=$_; + } +} + + + + + + + + +push (@{$cmdref->{arg}}, @ARGV); +foreach (keys %ENV) { + if (/^XCAT_/) { + $cmdref->{environment}->{$_} = $ENV{$_}; + } +} + +xCAT::Client::submit_request($cmdref,\&xCAT::Client::handle_response); +exit $xCAT::Client::EXITCODE; +