From 02135314e6d598c716c9796dc5e5ee36199cd90b Mon Sep 17 00:00:00 2001 From: mxi1 Date: Thu, 8 Jan 2009 07:00:27 +0000 Subject: [PATCH] -fix bug #2381472, add -v|--version options to nodeset git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2579 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/pxe.pm | 10 ++++++++++ xCAT-server/lib/xcat/plugins/yaboot.pm | 17 +++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/pxe.pm b/xCAT-server/lib/xcat/plugins/pxe.pm index 29922d975..41f8dfb7b 100644 --- a/xCAT-server/lib/xcat/plugins/pxe.pm +++ b/xCAT-server/lib/xcat/plugins/pxe.pm @@ -234,6 +234,16 @@ sub process_request { } else { if ($request->{node}) { @rnodes = ($request->{node}); } } + + my $args_ref = $request->{arg}; + if(scalar grep(/^--version$|^-v$/, @$args_ref)) { + my $ver = xCAT::Utils->Version(); + my %rsp; + $rsp{data}->[0]="$ver"; + $callback->(\%rsp); + return; + } + unless (@rnodes) { if ($usage{$request->{command}->[0]}) { $callback->({data=>$usage{$request->{command}->[0]}}); diff --git a/xCAT-server/lib/xcat/plugins/yaboot.pm b/xCAT-server/lib/xcat/plugins/yaboot.pm index 672986733..30ba0d952 100644 --- a/xCAT-server/lib/xcat/plugins/yaboot.pm +++ b/xCAT-server/lib/xcat/plugins/yaboot.pm @@ -256,6 +256,23 @@ sub process_request { } else { @args=($request->{arg}); } + + if(scalar grep /^--version$|^-v$/, @args) { + my $ver = xCAT::Utils->Version(); + my %rsp; + $rsp{data}->[0]="$ver"; + $callback->(\%rsp); + return; + } + if(scalar grep /^--help$|^-h$/, @args) { + if($usage{$request->{command}->[0]}) { + my %rsp; + $rsp{data}->[0]=$usage{$request->{command}->[0]}; + $callback->(\%rsp); + } + return; + } + unless ($args[0] eq 'stat' or $args[0] eq 'enact') { $sub_req->({command=>['setdestiny'], node=>\@nodes,