Browse Source

HPCC-12288 agentexec looks for config in code dir

Currently agentexec looks for the config file in the execution directory
given by argv[0]. Luckily this worked since argv[0] did not include the
path. This pull requests corrects this problem by looking in the current
directory.

Signed-off-by: William Whitehead william.whitehead@lexisnexis.com
William Whitehead 10 years ago
parent
commit
478ce67ede
2 changed files with 6 additions and 19 deletions
  1. 5 14
      ecl/agentexec/agentexec.cpp
  2. 1 5
      ecl/agentexec/agentexec.hpp

+ 5 - 14
ecl/agentexec/agentexec.cpp

@@ -42,7 +42,7 @@ CEclAgentExecutionServer::~CEclAgentExecutionServer()
 }
 
 
-void CEclAgentExecutionServer::start(StringBuffer & codeDir)
+void CEclAgentExecutionServer::start()
 {
     if (started)
     {
@@ -50,16 +50,11 @@ void CEclAgentExecutionServer::start(StringBuffer & codeDir)
         assert(false);
     }
 
-    codeDirectory = codeDir;
-    StringBuffer propertyFile = codeDirectory;
-    addPathSepChar(propertyFile);
-    propertyFile.append("agentexec.xml");
-
     Owned<IPropertyTree> properties;
     try
     {
-        DBGLOG("AgentExec: Loading properties file '%s'\n", propertyFile.str());
-        properties.setown(createPTreeFromXMLFile(propertyFile.str()));
+        DBGLOG("AgentExec: Loading properties file 'agentexec.xml'");
+        properties.setown(createPTreeFromXMLFile("agentexec.xml"));
     }
     catch (IException *e) 
     {
@@ -114,6 +109,7 @@ void CEclAgentExecutionServer::stop()
 
 int CEclAgentExecutionServer::run()
 {
+    SCMStringBuffer queueNames;
     Owned<IFile> sentinelFile = createSentinelTarget();
     removeSentinelFile(sentinelFile);
     try
@@ -263,13 +259,8 @@ int main(int argc, char **argv)
 
     try
     { 
-        StringBuffer codeDirectory;
-        splitFilename(argv[0], &codeDirectory, &codeDirectory, NULL, NULL);
-        if (!codeDirectory.length())
-            codeDirectory.append(".");
-        
         execSvr.setown(new CEclAgentExecutionServer());
-        execSvr->start(codeDirectory);
+        execSvr->start();
     } 
     catch (...)
     {

+ 1 - 5
ecl/agentexec/agentexec.hpp

@@ -28,7 +28,7 @@ public:
     CEclAgentExecutionServer();
     ~CEclAgentExecutionServer();
 
-    void start(StringBuffer & codeDir);
+    void start();
     void stop();
 
 private:
@@ -37,10 +37,6 @@ private:
 
     //attributes
     bool started;
-    StringBuffer codeDirectory;
-    StringBuffer logDir;
-    StringBuffer logfilespec;
-    SCMStringBuffer queueNames;
     StringAttr agentName;
     Owned<IJobQueue> queue;
     StringBuffer daliServers;