Flesh out the blade clicmds ssh support a bit more and accomodate CMM default password behavior/requirements
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@12104 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		| @@ -56,6 +56,9 @@ sub new { | ||||
| 	$self->waitfor("-match" => '/password:/i', -errmode => "return") or die "Unable to reach host ",$self->lastline; | ||||
| 	$self->print($password); | ||||
| 	my $nextline = $self->getline(); | ||||
|         if ($nextline eq "\n") { | ||||
| 		$nextline = $self->get(); | ||||
| 	} | ||||
| 	if ($nextline =~ /^password:/ or $nextline =~ /Permission denieid, please try again/) { | ||||
| 		die "Incorrect Password"; | ||||
| 	} | ||||
|   | ||||
| @@ -4029,12 +4029,32 @@ sub clicmds { | ||||
| 		-password=>$currpass, | ||||
| 		-host=>$curraddr, | ||||
| 		-nokeycheck=>$nokeycheck, | ||||
| 		-output_record_separator=>"\r", | ||||
|                 Timeout=>15,  | ||||
|                 Errmode=>'return', | ||||
|                 Prompt=>'/system> $/' | ||||
| 		); | ||||
|   my $Rc=1; | ||||
|   unless ($t) { #ssh failed.. fallback to a telnet attempt for older AMMs with telnet disabled by default | ||||
|   if ($t) { #we sshed in, but we may be forced to deal with initial password set | ||||
| 	my $output = $t->get(); | ||||
| 	if ($output =~ /Enter current password/) { | ||||
| 		$t->print($currpass); | ||||
| 		$t->waitfor(-match=>"/password:/i"); | ||||
| 		$t->print($pass); | ||||
| 		$t->waitfor(-match=>"/password:/i"); | ||||
| 		$t->print($pass); | ||||
| 		my $result=$t->getline(); | ||||
| 		chomp($result); | ||||
| 		$result =~ s/\s*//; | ||||
| 		while ($result eq "") { | ||||
| 			$result = $t->getline(); | ||||
| 			$result =~ s/\s*//; | ||||
| 		} | ||||
| 		if ($result =~ /not compliant/) { | ||||
|          		return ([1,\@unhandled,"Management module refuses requested password as insufficiently secure, try another password"]); | ||||
| 		} | ||||
| 	} | ||||
|   } else {#ssh failed.. fallback to a telnet attempt for older AMMs with telnet disabled by default | ||||
|      require Net::Telnet; | ||||
|      $t = new Net::Telnet( | ||||
|                    Timeout=>15,  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user