From f1768669433af33bb06bdcb45ca466132621ceee Mon Sep 17 00:00:00 2001 From: leiaibj Date: Tue, 15 Jan 2013 05:47:34 +0000 Subject: [PATCH] If no nodes specified for nodepurge, nodechprofile and noderefresh, then just print help message git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@14880 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/profilednodes.pm | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/profilednodes.pm b/xCAT-server/lib/xcat/plugins/profilednodes.pm index 8dc6a2d2b..6c729b6ab 100644 --- a/xCAT-server/lib/xcat/plugins/profilednodes.pm +++ b/xCAT-server/lib/xcat/plugins/profilednodes.pm @@ -428,10 +428,6 @@ Usage: #------------------------------------------------------- sub nodepurge{ my $nodes = $request->{node}; - xCAT::MsgUtils->message('S', "Purging nodes."); - # For remove nodes, we should call 'nodemgmt' in front of 'noderm' - setrsp_progress("Configuring nodes..."); - my $helpmsg = "nodepurge: Removes nodes from database and system configuration. Usage: \tnodepurge @@ -442,6 +438,14 @@ Usage: if (! $ret){ return; } + if (! $nodes){ + setrsp_infostr($helpmsg); + return; + } + + xCAT::MsgUtils->message('S', "Purging nodes."); + # For remove nodes, we should call 'nodemgmt' in front of 'noderm' + setrsp_progress("Configuring nodes..."); my $warnstr = ""; my $retref = xCAT::Utils->runxcmd({command=>["kitnoderemove"], node=>$nodes, sequential=>[1]}, $request_command, 0, 2); @@ -488,6 +492,10 @@ Usage: \tnoderefresh [-h|--help] \tnoderefresh {-v|--version}"; + if (! $nodes){ + setrsp_infostr($helpmsg); + return; + } my $ret = validate_args($helpmsg); if (! $ret){ return; @@ -514,13 +522,15 @@ Usage: #------------------------------------------------------- sub nodechprofile{ my $nodes = $request->{node}; - xCAT::MsgUtils->message('S', "Update nodes' profile settings."); - my $helpmsg = "nodechprofile: Update node profiles for profiled nodes. Usage: \tnodechprofile [networkprofile=] [imageprofile=] [hardwareprofile=] \tnodechprofile [-h|--help] \tnodechprofile {-v|--version}"; + if (! $nodes){ + setrsp_infostr($helpmsg); + return; + } my @enabledparams = ('networkprofile', 'hardwareprofile', 'imageprofile'); my $ret = validate_args($helpmsg, \@enabledparams); @@ -528,6 +538,7 @@ Usage: return; } + xCAT::MsgUtils->message('S', "Update nodes' profile settings."); my %updated_groups; # Get current templates for all nodes. setrsp_progress("Getting all node groups from the database...");