2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-06-16 11:20:32 +00:00

modify code per ErTao's suggestion

This commit is contained in:
Casandra Qiu
2016-09-22 11:09:06 -04:00
parent e7f8d4261c
commit 0a8379c9ec

View File

@ -207,8 +207,18 @@ sub bmcdiscovery_processargs {
############################################
# Option -U and -P for bmc user and password
############################################
#
# Get the default bmc account from passwd table,
# this is only done for the discovery process
#
($bmc_user, $bmc_pass) = bmcaccount_from_passwd();
# overwrite the default user and password if one is provided
if ($::opt_U) {
$bmc_user = $::opt_U;
} elsif ($::opt_P) {
# If password is provided, but no user, set the user to blank
# Support older FSP and Tuletta machines
$bmc_user = '';
}
if ($::opt_P) {
$bmc_pass = $::opt_P;
@ -246,23 +256,6 @@ sub bmcdiscovery_processargs {
return 1;
}
#
# Get the default bmc account from passwd table, this is only done for the
# discovery process
#
($bmc_user, $bmc_pass) = bmcaccount_from_passwd();
# overwrite the default password if one is provided
if ($::opt_U) {
$bmc_user = $::opt_U;
} else {
# If password is provided, but no user, set the user to blank
# Support older FSP and Tuletta machines
$bmc_user = '';
}
if ($::opt_P) {
$bmc_pass = $::opt_P;
}
scan_process($::opt_M, $::opt_R, $::opt_Z, $::opt_W, $request_command);
return 0;
}
@ -303,7 +296,7 @@ sub bmcdiscovery_processargs {
# --ipsource option, requires -i, -p to be specified
####################################################
if (defined($::opt_S)) {
if (defined($bmc_user) && defined($bmc_pass) && defined($::opt_I)) {
if (defined($bmc_pass) && defined($::opt_I)) {
my $res = get_bmc_ip_source($::opt_I, $bmc_user, $bmc_pass);
return $res;
}