From d776dd582f959ff6a2519dd31f5bfb567004e696 Mon Sep 17 00:00:00 2001 From: amy0701 Date: Thu, 4 Jun 2015 23:40:23 -0400 Subject: [PATCH] enhance errror msg if -u or -p is none for teamsun task45786. --- xCAT-server/lib/xcat/plugins/bmcdiscover.pm | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm index d17063712..d7404d4a6 100755 --- a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm @@ -224,11 +224,25 @@ sub bmcdiscovery_processargs { ######################################### # Option -i -u -p -c should be used together ###################################### - if ( defined($::opt_U) && defined($::opt_P) && defined($::opt_C) && defined($::opt_I) ) + + if ( defined($::opt_U) || defined($::opt_P) || defined($::opt_C) || defined($::opt_I) ) { - my $res=check_auth_process($::opt_I,$::opt_U,$::opt_P); - return $res; + if ( defined($::opt_U) && defined($::opt_P) && defined($::opt_C) && defined($::opt_I) ) + { + my $res=check_auth_process($::opt_I,$::opt_U,$::opt_P); + return $res; + } + else + { + my $msg = "bmc_ip or bmcuser or bmcpw is empty."; + my $rsp = {}; + push @{ $rsp->{data} }, "$msg"; + xCAT::MsgUtils->message("E", $rsp, $::CALLBACK); + return 2; + } + } + ######################################### # Other attributes are not allowed #########################################