enhancement of "rspconfig noderange USERID=<password>"

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@16408 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
zhaoertao 2013-05-23 08:23:21 +00:00
parent e6fedc6556
commit 1d89fb6e1b
3 changed files with 29 additions and 15 deletions

View File

@ -67,18 +67,26 @@ sub setupIMM {
#ok, with all ip addresses in hand, time to enable IPMI and set all the ip addresses (still static only, TODO: dhcp
my $ssh;
eval {$ssh = new xCAT::SSHInteract(-username=>$args{cliusername},
-password=>$args{clipassword},
-host=>$sship,
-nokeycheck=>1,
-output_record_separator=>"\r",
Timeout=>15,
Errmode=>'return',
Prompt=>'/> $/');};
my $errmsg = $@;
if ($errmsg) {
exit(0);
eval {$ssh = new xCAT::SSHInteract(-username=>$args{cliusername},
-password=>$args{clipassword},
-host=>$sship,
-nokeycheck=>1,
-output_record_separator=>"\r",
Timeout=>15,
Errmode=>'return',
Prompt=>'/> $/');};
my $errmsg = $@;
if ($errmsg) {
if ($errmsg =~ /Login Failed/) {
$errmsg = "Login failed";
} elsif ($errmsg =~ /Incorrect Password/) {
$errmsg = "Incorrect Password";
} else {
$errmsg = "Failed";
}
sendmsg(":$errmsg", $callback, $node);
exit(0);
}
if ($ssh and $ssh->atprompt) { #we are in and good to issue commands
$ssh->cmd("accseccfg -pe 0 -rc 0 -ci 0 -lf 0 -lp 0"); #disable the more insane password rules, this isn't by and large a human used interface
$ssh->cmd("users -1 -n ".$ipmiauthmap->{$node}->{username}." -p ".$ipmiauthmap->{$node}->{password}." -a super"); #this gets ipmi going
@ -97,6 +105,7 @@ sub setupIMM {
$ssh->close();
$ipmitab->setNodeAttribs($node,{bmcid=>$nodedata->{macaddress}});
}
sendmsg(":Succeeded", $callback,$node);
exit(0);
}

View File

@ -5012,7 +5012,7 @@ sub passwd {
} else {
return ([1, "Update password for $user in 'mpa' table failed"]);
}
return ([0, "Success"]);
return ([0, "Succeeded"]);
}

View File

@ -6120,11 +6120,16 @@ sub process_request {
}
if ($updatepasswd) {
splice(@{$request->{arg}}, $index, 1);
@exargs=($request->{arg});
@exargs=@{$request->{arg}};
foreach (@donargs) {
xCAT::IMMUtils::setupIMM($_->[0],curraddr=>$_->[1],skipbmcidcheck=>1,skipnetconfig=>1,cliusername=>$_->[2],clipassword=>$_->[3],callback=>$callback);
my $cliuser = $authdata->{$_->[0]}->{cliusername};
my $clipass = $authdata->{$_->[0]}->{clipassword};
xCAT::IMMUtils::setupIMM($_->[0],curraddr=>$_->[1],skipbmcidcheck=>1,skipnetconfig=>1,cliusername=>$cliuser,clipassword=>$clipass,callback=>$callback);
}
}
if ($#exargs == -1) {
return;
}
}
}
#get new node status