From 7062487b89d4f8e5208e046dc0822b3e62dc3055 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Mon, 20 Jul 2009 06:05:39 +0000 Subject: [PATCH] add the long name flag and make the -P is omitted when only scripts are specified git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3831 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/updatenode.pm | 30 ++++++++++++++++------ 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/updatenode.pm b/xCAT-server/lib/xcat/plugins/updatenode.pm index 53f565d07..22a6b024f 100644 --- a/xCAT-server/lib/xcat/plugins/updatenode.pm +++ b/xCAT-server/lib/xcat/plugins/updatenode.pm @@ -136,12 +136,12 @@ sub preprocess_updatenode { my $cb=shift; my $rsp={}; $rsp->{data}->[0]= "Usage:"; - $rsp->{data}->[1]= " updatenode [-F] [-S] [-P] [postscript,...]"; + $rsp->{data}->[1]= " updatenode [-V|--verbose] [-F|--sync] [-S|--sw] [-P|--scripts] [postscript,...]"; $rsp->{data}->[2]= " updatenode [-h|--help|-v|--version]"; $rsp->{data}->[3]= " is a list of nodes or groups."; - $rsp->{data}->[4]= " -F: Perform File Syncing."; - $rsp->{data}->[5]= " -S: Perform Software Maintenance."; - $rsp->{data}->[6]= " -p: Re-run Postscripts listed in postscript."; + $rsp->{data}->[4]= " -F|--sync: Perform File Syncing."; + $rsp->{data}->[5]= " -S|--sw: Perform Software Maintenance."; + $rsp->{data}->[6]= " -P|--scripts: Re-run Postscripts listed in postscript."; $rsp->{data}->[7]= " [postscript,...] is a comma separated list of postscript names."; $rsp->{data}->[8]= " If omitted, all the postscripts defined for the nodes will be run."; $cb->($rsp); @@ -159,9 +159,10 @@ sub preprocess_updatenode { if(!GetOptions( 'h|help' => \$::HELP, 'v|version' => \$::VERSION, - 'F' => \$::FILESYNC, - 'S' => \$::SWMAINTENANCE, - 'P:s' => \$::RERUNPS)) + 'V|verbose' => \$::VERBOSE, + 'F|sync' => \$::FILESYNC, + 'S|sw' => \$::SWMAINTENANCE, + 'P|scripts:s' => \$::RERUNPS)) { &updatenode_usage($callback); return \@requests;; @@ -181,7 +182,20 @@ sub preprocess_updatenode { $callback->($rsp); return \@requests; } - + + # the -P flag is omitted when only postscritps are specified, + # so if there are parameters without any flags, it means + # to re-run the postscripts. + if (@ARGV) { + if ($#ARGV == 0 && + !($::FILESYNC || $::SWMAINTENANCE || $::RERUNPS) ) { + $::RERUNPS = $ARGV[0]; + } else { + &updatenode_usage($callback); + return \@requests; + } + } + my $nodes = $request->{node}; if (!$nodes) { &updatenode_usage($callback);