From 0f50081b3a8d4bf111f15f3c0fa568a2765add36 Mon Sep 17 00:00:00 2001 From: nott Date: Sat, 7 Mar 2009 18:22:31 +0000 Subject: [PATCH] Set root directory correctly for AIX git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2852 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/credentials.pm | 23 +++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/credentials.pm b/xCAT-server/lib/xcat/plugins/credentials.pm index ecbb7c2fc..207525fdd 100644 --- a/xCAT-server/lib/xcat/plugins/credentials.pm +++ b/xCAT-server/lib/xcat/plugins/credentials.pm @@ -100,41 +100,56 @@ sub process_request my @filecontent; my $retdata; my $tfilename; + + my $root; + if (xCAT::Utils->isAIX()) { + $root = ""; + } else { + $root = "/root"; + } + foreach (@params_to_return) { + if (/ssh_root_key/) { - unless (-r "/root/.ssh/id_rsa") { + unless (-r "$root/.ssh/id_rsa") { push @{$rsp->{'error'}},"Unable to read root's private ssh key"; next; } - $tfilename = "/root/.ssh/id_rsa"; + $tfilename = "$root/.ssh/id_rsa"; + } elsif (/xcat_server_cred/) { unless (-r "/etc/xcat/cert/server-cred.pem") { push @{$rsp->{'error'}},"Unable to read root's private xCAT key"; next; } $tfilename = "/etc/xcat/cert/server-cred.pem"; + } elsif (/xcat_client_cred/ or /xcat_root_cred/) { - unless (-r "/root/.xcat/client-cred.pem") { + unless (-r "$root/.xcat/client-cred.pem") { push @{$rsp->{'error'}},"Unable to read root's private xCAT key"; next; } - $tfilename = "/root/.xcat/client-cred.pem"; + $tfilename = "$root/.xcat/client-cred.pem"; + } elsif (/ssh_dsa_hostkey/) { unless (-r "/etc/xcat/hostkeys/ssh_host_dsa_key") { push @{$rsp->{'error'}},"Unable to read private DSA key from /etc/xcat/hostkeys"; } $tfilename="/etc/xcat/hostkeys/ssh_host_dsa_key"; + } elsif (/ssh_rsa_hostkey/) { unless (-r "/etc/xcat/hostkeys/ssh_host_rsa_key") { push @{$rsp->{'error'}},"Unable to read private RSA key from /etc/xcat/hostkeys"; } $tfilename="/etc/xcat/hostkeys/ssh_host_rsa_key"; + } elsif (/xcat_cfgloc/) { unless (-r "/etc/xcat/cfgloc") { push @{$rsp->{'error'}},"Unable to read xCAT database location"; next; } $tfilename = "/etc/xcat/cfgloc"; + } else { next; }