add usage and argument check.

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@9308 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
sjing 2011-04-14 02:38:36 +00:00
parent 81330365cd
commit e748fe4c13

View File

@ -189,19 +189,30 @@ sub process_request {
my $hadargs=0;
my $allnodes;
my $zapfiles;
my $help;
my $deletemode=0;
if ($request->{arg}) {
$hadargs=1;
@ARGV=@{$request->{arg}};
Getopt::Long::Configure("no_pass_through");
if (!GetOptions(
'a|all' => \$allnodes,
'n|new' => \$zapfiles,
'd|delete' => \$deletemode,
'h|help' => \$help,
)) {
xCAT::SvrUtils::sendmsg([1,"TODO: makedns Usage message"], $callback);
#xCAT::SvrUtils::sendmsg([1,"TODO: makedns Usage message"], $callback);
makedns_usage($callback);
return;
}
}
if ($help)
{
makedns_usage($callback);
}
$ctx->{deletemode}=$deletemode;
my $sitetab = xCAT::Table->new('site');
@ -905,4 +916,21 @@ sub genpassword
}
return $password;
}
sub makedns_usage
{
my $callback = shift;
my $rsp;
push @{$rsp->{data}},
"\n makedns - sets up domain name services (DNS).";
push @{$rsp->{data}}, " Usage: ";
push @{$rsp->{data}}, "\tmakedns [-h|--help ]";
push @{$rsp->{data}}, "\tmakedns [-n|--new ] [noderange]";
push @{$rsp->{data}}, "\tmakedns [-d|--delete ] [noderange]";
push @{$rsp->{data}}, "\n";
xCAT::MsgUtils->message("I", $rsp, $callback);
return 0;
}
1;