From f7f1f7dee899450c9044be62de6f3a5434f19606 Mon Sep 17 00:00:00 2001 From: mellor Date: Mon, 3 Dec 2007 20:29:30 +0000 Subject: [PATCH] fixed Client.pm to handle user-specified xcatprefix directory in XCATBYPASS mode git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@122 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT-2.0/xCAT/Client.pm | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/perl-xCAT-2.0/xCAT/Client.pm b/perl-xCAT-2.0/xCAT/Client.pm index 2a7e97fbe..9b3bf87df 100644 --- a/perl-xCAT-2.0/xCAT/Client.pm +++ b/perl-xCAT-2.0/xCAT/Client.pm @@ -3,6 +3,7 @@ package xCAT::Client; use xCAT::NodeRange; use xCAT::Utils; +use xCAT::Table; use IO::Socket::SSL; if (xCAT::Utils->isLinux()) { @@ -19,7 +20,7 @@ use XML::Simple; use Data::Dumper; use Storable qw(dclone); my $xcathost='localhost:3001'; -my $plugins_dir='/usr/lib/xcat/plugins'; +my $plugins_dir; my %resps; 1; @@ -61,6 +62,7 @@ sub submit_request { my $request = shift; my $callback = shift; + # If XCATBYPASS is set, invoke the plugin process_request method directly # without going through the socket connection to the xcatd daemon if ($ENV{XCATBYPASS}) { @@ -73,6 +75,17 @@ sub submit_request { scan_plugins(); } } else { + # figure out default plugins dir + my $sitetab=xCAT::Table->new('site'); + unless ($sitetab) { + print ("ERROR: Unable to open basic site table for configuration\n"); + } + $::XCATPREFIX = '/usr'; + my ($tmp) = $sitetab->getAttribs({'key'=>'xcatprefix'},'value'); + if ($tmp and $tmp->{value}) { + $::XCATPREFIX = $tmp->{value}; + } + $plugins_dir=$::XCATPREFIX.'/lib/xcat/plugins'; scan_plugins(); }