From ab40158ba6d88a4a2e1468dc697859bca7fd1342 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Mon, 21 May 2012 13:59:40 +0000 Subject: [PATCH] More cleanly wrap login failures for clicmdns git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@12846 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/blade.pm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/blade.pm b/xCAT-server/lib/xcat/plugins/blade.pm index ece8b7037..04c5734fc 100644 --- a/xCAT-server/lib/xcat/plugins/blade.pm +++ b/xCAT-server/lib/xcat/plugins/blade.pm @@ -4030,7 +4030,9 @@ sub clicmds { } } require xCAT::SSHInteract; - my $t = new xCAT::SSHInteract( + my $t; + eval { + $t = new xCAT::SSHInteract( -username=>$curruser, -password=>$currpass, -host=>$curraddr, @@ -4040,6 +4042,16 @@ sub clicmds { Errmode=>'return', Prompt=>'/system> $/' ); + }; + my $errmsg=$@; + if ($errmsg) { + if ($errmsg =~ /Login Failed/) { + $errmsg = "Failed to login to $mpa"; + if ($curraddr ne $mpa) { $errmsg .= " (currently at $curraddr)" } + push @cfgtext,$errmsg; + return([1,\@unhandled,$errmsg]); + } else { die $@; } + } my $Rc=1; if ($t and not $t->atprompt) { #we sshed in, but we may be forced to deal with initial password set my $output = $t->get();