checkCredFiles additions

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2980 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
lissav 2009-03-25 12:09:22 +00:00
parent 5eb274f3a3
commit 16ccb564a4

View File

@ -3437,7 +3437,7 @@ sub osver
#-------------------------------------------------------------------------------
=head3 checkCreds
=head3 checkCredFiles
Checks the various credential files on the Management Node to
make sure the permission are correct for using and transferring
to the nodes and service nodes.
@ -3458,9 +3458,9 @@ sub osver
=cut
#-------------------------------------------------------------------------------
sub checkCreds
sub checkCredFiles
{
my $lib = shift;
my $lib = shift;
my $cb = shift;
my $dir = "/install/postscripts/_xcat";
if (-d $dir)
@ -3492,6 +3492,28 @@ sub checkCreds
$rsp->{data}->[0] = "Error: $dir is missing.";
xCAT::MsgUtils->message("I", $rsp, $cb);
}
my $dir = "/etc/xcat/cert";
if (-d $dir)
{
my $file = "$dir/server-cred.pem"; # from getcredentials
if (!(-e $file))
{
my $rsp = {};
$rsp->{data}->[0] = "Error: $file is missing.";
xCAT::MsgUtils->message("I", $rsp, $cb);
}
}
else
{
my $rsp = {};
$rsp->{data}->[0] = "Error: $dir is missing.";
xCAT::MsgUtils->message("I", $rsp, $cb);
}
my $dir = "/install/postscripts/ca";
if (-d $dir)
{
@ -3523,6 +3545,40 @@ sub checkCreds
xCAT::MsgUtils->message("I", $rsp, $cb);
}
# todo, I think next release this directory can be removed and
# copycerts modified because ca.pem is gotten by getcredentials from
# /etc/xcat/cert
my $dir = "/install/postscripts/cert";
if (-d $dir)
{
my $file = "$dir/ca.pem";
if (-e $file)
{
my $file2 = "$dir/*" ;
my $cmd = "/bin/chmod 0644 $file2";
my $outref = xCAT::Utils->runcmd("$cmd", 0);
if ($::RUNCMD_RC != 0)
{
my $rsp = {};
$rsp->{data}->[0] = "Error on command: $cmd";
xCAT::MsgUtils->message("I", $rsp, $cb);
}
}
else
{ # ca.pem missing
my $rsp = {};
$rsp->{data}->[0] = "Error: $file is missing.";
xCAT::MsgUtils->message("I", $rsp, $cb);
}
}
else
{
my $rsp = {};
$rsp->{data}->[0] = "Error: $dir is missing.";
xCAT::MsgUtils->message("I", $rsp, $cb);
}
# ssh hostkeys
my $dir = "/install/postscripts/hostkeys";
if (-d $dir)