From 2e63607c8c4bfe13e516000dff0ae05c374e8839 Mon Sep 17 00:00:00 2001 From: immarvin Date: Wed, 18 Oct 2017 02:46:56 -0400 Subject: [PATCH] refine the message in rspconfig sshcfg --- perl-xCAT/xCAT/RemoteShellExp.pm | 8 ++++---- xCAT-server/lib/xcat/plugins/openbmc.pm | 18 +++++++++--------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/perl-xCAT/xCAT/RemoteShellExp.pm b/perl-xCAT/xCAT/RemoteShellExp.pm index 19ee11541..fd4ecef22 100755 --- a/perl-xCAT/xCAT/RemoteShellExp.pm +++ b/perl-xCAT/xCAT/RemoteShellExp.pm @@ -466,7 +466,7 @@ sub testkeys return 0; } else { my $rsp = {}; - $rsp->{error}->[0] = $msg; + $rsp->{error}->[0] = "Testing the ssh connection to $nodes failed:".$msg; xCAT::MsgUtils->message("E", $rsp, $::CALLBACK); return 1; } @@ -598,7 +598,7 @@ sub sendnodeskeys $rc = 0; } else { my $rsp = {}; - $rsp->{error}->[0] = "mkdir:$node has error,$msg"; + $rsp->{error}->[0] = "Failed to run \"/bin/mkdir -p /tmp/$to_userid/.ssh\" on $node: $msg"; xCAT::MsgUtils->message("E", $rsp, $::CALLBACK); $rc = 1; } @@ -686,7 +686,7 @@ sub sendnodeskeys $rc = 0; } else { my $rsp = {}; - $rsp->{error}->[0] = "copykeys:$node has error,$msg"; + $rsp->{error}->[0] = "Failed to copy ssh credentials and helper script to $node: $msg"; xCAT::MsgUtils->message("E", $rsp, $::CALLBACK); $rc = 1; } @@ -771,7 +771,7 @@ sub sendnodeskeys $rc = 0; } else { my $rsp = {}; - $rsp->{error}->[0] = "copy.sh:$node has error,$msg"; + $rsp->{error}->[0] = "Failed to apply the ssh keys on $node:$msg"; xCAT::MsgUtils->message("E", $rsp, $::CALLBACK); $rc = 1; } diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 5ce89416f..5c5b2f318 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -1963,15 +1963,15 @@ rmdir \"/tmp/$userid\" \n"; my $rc=xCAT::RemoteShellExp->remoteshellexp("s",$callback,"/usr/bin/ssh",$bmcip,10); if ($rc) { xCAT::SvrUtils::sendmsg("Error copying ssh keys to $bmcip\n", $callback, $node); - } - - #check whether the ssh keys has been sent successfully - $rc=xCAT::RemoteShellExp->remoteshellexp("t",$callback,"/usr/bin/ssh",$bmcip,10); - if ($rc) { - xCAT::SvrUtils::sendmsg("Error copying ssh keys to $bmcip Rerun rspconfig command.", $callback, $node); - } - else { - xCAT::SvrUtils::sendmsg("ssh keys copied to $bmcip", $callback, $node); + }else{ + #check whether the ssh keys has been sent successfully + $rc=xCAT::RemoteShellExp->remoteshellexp("t",$callback,"/usr/bin/ssh",$bmcip,10); + if ($rc) { + xCAT::SvrUtils::sendmsg("Testing the ssh connection to $bmcip failed. Please rerun rspconfig command.", $callback, $node); + } + else { + xCAT::SvrUtils::sendmsg("ssh keys copied to $bmcip", $callback, $node); + } } #restore env variables