diff --git a/perl-xCAT-2.0/xCAT/PPC.pm b/perl-xCAT-2.0/xCAT/PPC.pm index 07aeb2671..9fa60710c 100644 --- a/perl-xCAT-2.0/xCAT/PPC.pm +++ b/perl-xCAT-2.0/xCAT/PPC.pm @@ -239,18 +239,24 @@ sub resolve_hcp { #################################### # Process each node #################################### - foreach ( @$noderange ) { - my ($ent) = $db->getAttribs( {hcp=>$_},"hcp" ); + foreach my $hcp ( @$noderange ) { + my ($ent) = $db->getAttribs( {hcp=>$hcp},"hcp" ); if ( !defined( $ent )) { - my $msg = sprintf( "$_: $errmsg{NODE_UNDEF}", $tab ); + my $msg = sprintf( "$hcp: $errmsg{NODE_UNDEF}", $tab ); send_msg( $request, 1, $msg ); next; } + ################################ + # Get userid and password + ################################ + my @cred = xCAT::PPCdb::credentials( $hcp, $request->{hwtype} ); + $request->{$hcp}{cred} = \@cred; + ################################ # Save values ################################ - push @nodegroup,[$_]; + push @nodegroup,[$hcp]; } return( \@nodegroup ); @@ -322,6 +328,13 @@ sub preprocess_nodes { $nodehash{$hcp}{$mtms}{$node} = $d; } ########################################## + # Get userid and password + ########################################## + while (my ($hcp,$hash) = each(%nodehash) ) { + my @cred = xCAT::PPCdb::credentials( $hcp, $request->{hwtype} ); + $request->{$hcp}{cred} = \@cred; + } + ########################################## # Group the nodes - we will fork one # process per nodegroup array element. ########################################## diff --git a/perl-xCAT-2.0/xCAT/PPCcli.pm b/perl-xCAT-2.0/xCAT/PPCcli.pm index cb0106ad1..33c7b3a19 100644 --- a/perl-xCAT-2.0/xCAT/PPCcli.pm +++ b/perl-xCAT-2.0/xCAT/PPCcli.pm @@ -5,7 +5,6 @@ use strict; require Exporter; our @ISA = qw(Exporter); our @EXPORT_OK = qw(SUCCESS RC_ERROR EXPECT_ERROR NR_ERROR); -use xCAT::PPCdb; use Expect; @@ -91,12 +90,8 @@ sub connect { ################################################## # Get userid/password ################################################## - my @cred = xCAT::PPCdb::credentials( $server, $hwtype ); - - ################################################## - # ssh to remote host - ################################################## - my $parameters = "$cred[0]\@$server"; + my $cred = $req->{$server}{cred}; + my $parameters = "@$cred[0]\@$server"; ################################################## # Redirect STDERR to variable @@ -131,7 +126,7 @@ sub connect { while ( $retry-- ) { my $success = 0; my $pwd_sent = 0; - $expect_log = undef; + $expect_log = undef; $ssh = new Expect; @@ -172,7 +167,7 @@ sub connect { [ $pwd_prompt, sub { if ( ++$pwd_sent == 1 ) { - $ssh->send( "$cred[1]\r" ); + $ssh->send( "@$cred[1]\r" ); $ssh->exp_continue(); } } ], @@ -206,8 +201,8 @@ sub connect { $prompt{$hwtype}, $hwtype, $server, - $cred[0], - $cred[1], + @$cred[0], + @$cred[1], \$expect_log, $timeout ); } diff --git a/perl-xCAT-2.0/xCAT/PPCfsp.pm b/perl-xCAT-2.0/xCAT/PPCfsp.pm index 23d73d42c..57bdefb53 100644 --- a/perl-xCAT-2.0/xCAT/PPCfsp.pm +++ b/perl-xCAT-2.0/xCAT/PPCfsp.pm @@ -9,6 +9,7 @@ use HTML::Form; use xCAT::PPCcli qw(SUCCESS EXPECT_ERROR RC_ERROR NR_ERROR); use xCAT::Usage; + ########################################## # Globals ########################################## @@ -236,7 +237,7 @@ sub connect { ################################## # Get userid/password ################################## - my @cred = xCAT::PPCdb::credentials( $server, "fsp" ); + my $cred = $req->{$server}{cred}; ################################## # Redirect STDERR to variable @@ -275,8 +276,8 @@ sub connect { # Submit logon ################################## my $res = $ua->post( $url, - [ user => $cred[0], - password => $cred[1], + [ user => @$cred[0], + password => @$cred[1], lang => "0", submit => "Log in" ] ); @@ -306,7 +307,7 @@ sub connect { ############################## return( $ua, $server, - $cred[0], + @$cred[0], \$lwp_log ); } ##############################