From 16ccb564a4680be69f2eb84135f7fb926ce7d3d1 Mon Sep 17 00:00:00 2001 From: lissav Date: Wed, 25 Mar 2009 12:09:22 +0000 Subject: [PATCH] checkCredFiles additions git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2980 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/Utils.pm | 62 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 59 insertions(+), 3 deletions(-) diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index 494f35821..736373221 100644 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -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)