From 2cddbeb6de3528b3b8e50265579244e8aad8992a Mon Sep 17 00:00:00 2001 From: lissav Date: Wed, 14 Jan 2009 15:54:57 +0000 Subject: [PATCH] change the setupSSH routine to only regenerate the ssh keys if they do not exist in roots home directory git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2602 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/Utils.pm | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index 6be6d6d8e..f193b1ddc 100644 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -1080,14 +1080,19 @@ sub setupSSH mkdir("/install/postscripts/.ssh", 0755); } - # Generate the keys + # Generate the keys, if they do not already exist my $rsp={}; - xCAT::Utils->runcmd("$::REMOTESHELL_EXPECT -k", 0); - if ($::RUNCMD_RC != 0) - { # error - $rsp->{data}->[0] = "remoteshell.expect failed generating keys."; - xCAT::MsgUtils->message("E", $rsp, $::CALLBACK); + my $home = xCAT::Utils->getHomeDir("root"); + if ( !(-e "$home/.ssh/id_rsa.pub") + || !(-e "$home/.ssh/id_dsa.pub")) + { + xCAT::Utils->runcmd("$::REMOTESHELL_EXPECT -k", 0); + if ($::RUNCMD_RC != 0) + { # error + $rsp->{data}->[0] = "remoteshell.expect failed generating keys."; + xCAT::MsgUtils->message("E", $rsp, $::CALLBACK); + } } # Copy the keys to the directory