Selaa lähdekoodia

Bug: 83862 Clean code for WsSMC, WSTopology, ws_machine

(1) remove code lines which have been commented out; (2) remove
most of debug lines; (3) modify debug log lines which should only
be used at high log levels; (4) modify debug log lines which should
have 'WARNING' in the front of the log lines.

Signed-off-by: Kevin Wang <kevin.wang@lexisnexis.com>
Kevin Wang 14 vuotta sitten
vanhempi
commit
9c89d54a87

+ 20 - 154
esp/services/ws_machine/ws_machineService.cpp

@@ -63,10 +63,6 @@
 #define eqThorSpareProcess      "ThorSpareProcess"
 #endif
 
-//#ifndef eqTHORMACHINES
-//#define eqTHORMACHINES            "THORMACHINES"
-//#endif
-
 #ifndef eqHOLEMACHINES
 #define eqHOLEMACHINES          "HOLEMACHINES"
 #endif
@@ -267,18 +263,6 @@ void Cws_machineEx::init(IPropertyTree *cfg, const char *process, const char *se
     {
         m_machineInfoFile.append("preflight");
     }
-#ifdef USE_ENV_CONF_FILE
-    Owned<IEnvironmentFactory> envFactory = getEnvironmentFactory();
-    const char* envConf = envFactory->getEnvironmentConf();
-    if (envConf)
-    {
-        readAString(envConf, "configs=", "\r", m_environmentConfData.m_configsPath, true);
-        readAString(envConf, "path=", "\r", m_environmentConfData.m_executionPath, true);
-        readAString(envConf, "runtime=", "\r", m_environmentConfData.m_runtimePath, true);
-        readAString(envConf, "lock=", "\r", m_environmentConfData.m_lockPath, true);
-        readAString(envConf, "pid=", "\r", m_environmentConfData.m_pidPath, true);
-    }
-#else
     Owned<IConstEnvironment> constEnv = getConstEnvironment();
     Owned<IPropertyTree> pRoot = &constEnv->getPTree();
     IPropertyTree* pEnvSettings = pRoot->getPropTree("EnvSettings");
@@ -290,14 +274,12 @@ void Cws_machineEx::init(IPropertyTree *cfg, const char *process, const char *se
         pEnvSettings->getProp("lock", m_environmentConfData.m_lockPath.clear());
         pEnvSettings->getProp("pid", m_environmentConfData.m_pidPath.clear());
     }
-#endif
     IThreadFactory* pThreadFactory = new CWsMachineThreadFactory();
     m_threadPool.setown(createThreadPool("WsMachine Thread Pool", pThreadFactory,
         NULL, THREAD_POOL_SIZE, 10000, THREAD_POOL_STACK_SIZE)); //10 sec timeout for available thread; use stack size of 2MB
     pThreadFactory->Release();
 
     //populate the process type to SNMP component index map
-    //
     if (s_processTypeToSnmpIdMap.empty())
     {
         //add mappings in random order to keep the map balanced
@@ -318,10 +300,6 @@ void Cws_machineEx::init(IPropertyTree *cfg, const char *process, const char *se
         s_processTypeToProcessMap.insert(pair<string, const char*>("EclServerProcess",   "eclserver"));
         s_processTypeToProcessMap.insert(pair<string, const char*>("FTSlaveProcess",         "ftslave"));
         s_processTypeToProcessMap.insert(pair<string, const char*>("SashaServerProcess", "saserver"));
-        //s_processTypeToProcessMap.insert(pair<string, string>("LDAPServerProcess", "saserver"));
-        //s_processTypeToProcessMap.insert(pair<string, string>("MySQLProcess", "saserver"));
-        //s_processTypeToProcessMap.insert(pair<string, string>("EclAgentProcess", "saserver"));
-
         s_processTypeToProcessMap.insert(pair<string, const char*>("ThorMasterProcess",  "thormaster"));
         s_processTypeToProcessMap.insert(pair<string, const char*>("RoxieServerProcess", "roxie"));
     }
@@ -408,8 +386,6 @@ bool Cws_machineEx::onGetMachineInfo(IEspContext &context, IEspGetMachineInfoReq
         IArrayOf<IEspMachineInfoEx> machineArray;
         StringArray columnArray;
 
-        //const char* userName = req.getUserName();
-        //const char* password = req.getPassword();
         const char* userName = m_sTestStr1.str();
         const char* password = m_sTestStr2.str();
         if (userName && *userName)
@@ -511,14 +487,6 @@ void Cws_machineEx::RunMachineQuery(IEspContext &context, StringArray &addresses
           try
           {
               //xpath is the Path to parent node (normally a cluster)
-#if 0
-            const int SDS_LOCK_TIMEOUT = 20000;
-              Owned<IRemoteConnection> conn = querySDS().connect(decodedPath, myProcessSession(), RTM_LOCK_READ, SDS_LOCK_TIMEOUT);
-            if (!conn)
-               throw MakeStringException(-1, "Specified path '%s' is invalid!", decodedPath.str());
-
-              bMonitorDaliFileServer = conn->queryRoot()->getPropBool("@monitorDaliFileServer", false);
-#else
             Owned<IEnvironmentFactory> envFactory = getEnvironmentFactory();
             Owned<IConstEnvironment> constEnv = envFactory->openEnvironmentByFile();
             Owned<IPropertyTree> root0 = &constEnv->getPTree();
@@ -534,7 +502,6 @@ void Cws_machineEx::RunMachineQuery(IEspContext &context, StringArray &addresses
                 throw MakeStringException(ECLWATCH_INVALID_INPUT, "Specified path '%s' is invalid!", decodedPath.str());
 
             bMonitorDaliFileServer = root->getPropBool("@monitorDaliFileServer", false);
-#endif
           }
           catch(IException* e)
          {
@@ -572,8 +539,6 @@ void Cws_machineEx::RunMachineQuery(IEspContext &context, StringArray &addresses
     set<string>   columnSet;
     IpAddress     ipAddr;
 
-    // TBD IPv6 (cannot use long for map)
-
     for (index=0; index<ordinality; index++)
     {
         char *address = strdup( addresses.item(index) );
@@ -654,7 +619,6 @@ void Cws_machineEx::RunMachineQuery(IEspContext &context, StringArray &addresses
             bFilterProcesses = false;
 
       //OS is constant for a m/c so can be ignored if IP is already recorded
-      //
         if (*address.str())
         {
             bool bAgentExec = stricmp(sProcessType.str(), "EclAgentProcess")==0;
@@ -689,7 +653,6 @@ void Cws_machineEx::RunMachineQuery(IEspContext &context, StringArray &addresses
       }
     }
    //block for worker theads to finish, if necessary and then collect results
-   //
     PooledThreadHandle* pThreadHandle = threadHandles.getArray();
     unsigned i=threadHandles.ordinality();
     while (i--)
@@ -700,7 +663,6 @@ void Cws_machineEx::RunMachineQuery(IEspContext &context, StringArray &addresses
 }
 
 // the following method is invoked on worker threads of
-//
 void Cws_machineEx::getUpTime(CMachineInfoThreadParam* pParam, StringBuffer& out)
 {
     if (pParam->m_sAddress.length() < 1)
@@ -880,9 +842,6 @@ int Cws_machineEx::readMachineInfo(const char *response, CMachineInfo& machineIn
     readAString(response, "CPU-Idle:", "\r", machineInfo.m_sCPUIdle, true);
     readAString(response, "ComputerUpTime:", "\r", computerUptime, true);
 
-    //if (machineInfo.m_sCPUIdle.charAt(machineInfo.m_sCPUIdle.length() - 1) == '%')
-    //  machineInfo.m_sCPUIdle.remove(machineInfo.m_sCPUIdle.length() - 1, 1);
-
     const char* spaceLine = "---SpaceUsedAndFree---";
     char* pStr = (char*) strstr(response, spaceLine);
     if (pStr)
@@ -951,7 +910,6 @@ int Cws_machineEx::runCommand(IEspContext& context, const char* sAddress, const
         }
 
 #ifdef _WIN32
-///#define CHECK_LINUX_COMMAND
 #ifndef CHECK_LINUX_COMMAND
 #define popen  _popen
 #define pclose _pclose
@@ -1098,35 +1056,29 @@ int Cws_machineEx::invokeProgram(const char *command_line, StringBuffer& respons
    char   buffer[128];
    FILE   *fp;
 
-   /* Run the command so that it writes its output to a pipe. Open this
-    * pipe with read text attribute so that we can read it
-    * like a text file.
-    */
-    if (getEspLogLevel()>8)
+   // Run the command so that it writes its output to a pipe. Open this
+   // pipe with read text attribute so that we can read it
+   // like a text file.
+    if (getEspLogLevel()>LogNormal)
     {
         DBGLOG("command_line=<%s>", command_line);
     }
-#ifdef CHECK_LINUX_COMMAND
-    return -1;
-#else
    if( (fp = popen( command_line, "r" )) == NULL )
       return -1;
 
-    /* Read pipe until end of file. End of file indicates that
-    * the stream closed its standard out (probably meaning it
-    * terminated).
-    */
+    // Read pipe until end of file. End of file indicates that
+    //the stream closed its standard out (probably meaning it
+    //terminated).
    while ( !feof(fp) )
       if ( fgets( buffer, 128, fp) )
          response.append( buffer );
 
-    if (getEspLogLevel()>8)
+    if (getEspLogLevel()>LogNormal)
     {
         DBGLOG("response=<%s>", response.str());
     }
-    /* Close pipe and print return value of CHKDSK. */
+    // Close pipe and print return value of CHKDSK.
    return pclose( fp );
-#endif
 }
 
 int Cws_machineEx::remoteGetMachineInfo(IEspContext& context, const char *address, const char *configAddress, const char *preflightCommand, const char* user, const char* password, StringBuffer& sResponse, CMachineInfo& machineInfo)
@@ -1153,10 +1105,8 @@ int Cws_machineEx::remoteGetMachineInfo(IEspContext& context, const char *addres
 }
 
 // the following method is invoked on worker threads of
-//
 void Cws_machineEx::doGetMachineInfo(IEspContext& context, CMachineInfoThreadParam* pParam)
 {
-    //DBGLOG("Getting MachineInfo for %s", pParam->m_sAddress.str());
    IEspMachineInfoEx* info = pParam->m_pMachineInfo;
    IEspMachineInfoEx* info1 = pParam->m_pMachineInfo1;
    StringBuffer& sSecurityString = pParam->m_sSecurityString;
@@ -1200,7 +1150,6 @@ void Cws_machineEx::doGetMachineInfo(IEspContext& context, CMachineInfoThreadPar
         }
         else
         {
-            ///preFlightStr.appendf("/%s/%s/%s", m_environmentConfData.m_runtimePath.str(), pParam->m_sCompName.str(), m_machineInfoFile.str());
             preFlightCommand.appendf("/%s/sbin/%s %s", m_environmentConfData.m_executionPath.str(), m_machineInfoFile.str(), m_environmentConfData.m_pidPath.str());
             if (preFlightCommand.charAt(preFlightCommand.length() - 1) == '/')
                 preFlightCommand.remove(preFlightCommand.length()-1, 1);
@@ -1255,10 +1204,6 @@ void Cws_machineEx::doGetMachineInfo(IEspContext& context, CMachineInfoThreadPar
                     info1->setRunning(runArray);
             }
 
-            //info->setUpTime(machine->getUpTime(temp).str());
-
-            ///StringBuffer out;
-            ///getUpTime(pParam, out);
             if (machineInfo.m_sComputerUptime.length() > 0)
             {
                 info->setUpTime(machineInfo.m_sComputerUptime.str());
@@ -1296,16 +1241,11 @@ void Cws_machineEx::doGetSecurityString(const char* address, StringBuffer& secur
 {
    //another client (like configenv) may have updated the constant environment and we got notified
    //(thanks to our subscription) so reload it
-   //
    m_envFactory->validateCache();
 
    securityString.clear();
-#if 0
-    Owned<IConstMachineInfo> machine = m_constEnv->getMachineByAddress(address);
-#else
     Owned<IConstEnvironment> constEnv = getConstEnvironment();
     Owned<IConstMachineInfo> machine = constEnv->getMachineByAddress(address);
-#endif
     if (machine)
    {
        Owned<IConstDomainInfo> domain = machine->getDomain();
@@ -1322,34 +1262,20 @@ IPropertyTree* Cws_machineEx::getComponent(const char* compType, const char* com
     StringBuffer xpath;
     xpath.append("Software/").append(compType).append("[@name='").append(compName).append("']");
 
-   //another client (like configenv) may have updated the constant environment and we got notified
-   //(thanks to our subscription) so reload it
-   //
    m_envFactory->validateCache();
 
-#if 0
-    Owned<IPropertyTree> pEnvRoot = &m_constEnv->getPTree();
-#else
     Owned<IConstEnvironment> constEnv = getConstEnvironment();
     Owned<IPropertyTree> pEnvRoot = &constEnv->getPTree();
-#endif
     return pEnvRoot->getPropTree( xpath.str() );
 }
 
 void Cws_machineEx::getAccountAndPlatformInfo(const char* address, StringBuffer& userId,
                                               StringBuffer& password, bool& bLinux)
 {
-   //another client (like configenv) may have updated the constant environment and we got notified
-   //(thanks to our subscription) so reload it
-   //
    m_envFactory->validateCache();
 
-#if 0
-    Owned<IConstMachineInfo> machine = m_constEnv->getMachineByAddress(address);
-#else
     Owned<IConstEnvironment> constEnv = getConstEnvironment();
     Owned<IConstMachineInfo> machine = constEnv->getMachineByAddress(address);
-#endif
     if (!machine && !stricmp(address, "."))
     {
         machine.setown(constEnv->getMachineByAddress("127.0.0.1"));
@@ -1401,7 +1327,6 @@ void Cws_machineEx::determineRequredProcesses(CMachineInfoThreadParam* pParam,
 
    //first collect all "common" processes that are required on any box irrespective of
    //its type
-   //
    StringBuffer xPath("ProcessFilter[@name='any']/Process");
    Owned<IPropertyTreeIterator> iProcesses = pOsSpecificFilters->getElements(xPath.str());
    ForEach (*iProcesses)
@@ -1411,7 +1336,6 @@ void Cws_machineEx::determineRequredProcesses(CMachineInfoThreadParam* pParam,
 
       //if this process name is valid and either we are monitoring dali file server or
       //(we are not monitoring that and) it is not that process then add it to list of required processes
-      //
         if (m_useDefaultHPCCInit)
         {
             if (*sProcessName.str() && (bMonitorDaliFileServer || 0 != strcmp(sProcessName.str(), "dafilesrv")))
@@ -1425,14 +1349,12 @@ void Cws_machineEx::determineRequredProcesses(CMachineInfoThreadParam* pParam,
    }
 
    //insert all additional processes that may have been specified with the request
-   //
    int len = additionalProcesses.length();
    for (int i=0; i<len; i++)
       requiredProcesses.insert(additionalProcesses.item(i));
 
    //now collect all "box-specific" processes that are required to be running
    //for eg. thorslave[.exe] on a thor slave box
-   //
    if (pszProcessType && *pszProcessType)
    {
       xPath.clear().appendf("ProcessFilter[@name='%s']", pszProcessType);
@@ -1450,29 +1372,14 @@ void Cws_machineEx::determineRequredProcesses(CMachineInfoThreadParam* pParam,
             {
                 IPropertyTree* pProcess = &iProcesses->query();
                 bool bRemove = pProcess->getPropBool("@remove", false);
-
-#if 0
-                if (m_enableSNMP)
-                {
-                    sProcessName.clear().append(pProcess->queryProp("@name"));
-                    if (!bRemove && pParam->m_bMultipleInstances && pParam->m_sPath.length())
-                        sProcessName.insert(0, pParam->m_sPath);
-                    else
-                        sProcessName.toLowerCase().replaceString(".exe", "");
-                }
+                const char* sName = pProcess->queryProp("@name");
+                sProcessName.clear();
+                if (!strcmp(sName, "."))
+                    sProcessName = pParam->m_sCompName;
                 else
-#endif
-                {
-                    const char* sName = pProcess->queryProp("@name");
-                    sProcessName.clear();
-                    if (!strcmp(sName, "."))
-                        ///sProcessName.appendf("%s/%s", m_environmentConfData.m_runtimePath.str(), pParam->m_sCompName.str());
-                        sProcessName = pParam->m_sCompName;
-                    else
-                        sProcessName.append(sName);
-                    if (bRemove)
-                        sProcessName.toLowerCase().replaceString(".exe", "");
-                }
+                    sProcessName.append(sName);
+                if (bRemove)
+                    sProcessName.toLowerCase().replaceString(".exe", "");
 
                 if (*sProcessName.str())
                 {
@@ -1481,13 +1388,11 @@ void Cws_machineEx::determineRequredProcesses(CMachineInfoThreadParam* pParam,
                     else
                     {
                         //support multithor: if this is a linux system and processtype is either a thor master or slave
-                        //
                         if (!strncmp(pszProcessType, "Thor", 4) && pParam->m_operatingSystem != OS_Windows)
                         {
                             //lookup port from environment
                             Owned<IPropertyTree> pComponent = getComponent("ThorCluster", strCompName.str());
                             const bool bMaster = !strcmp(pszProcessType, "ThorMasterProcess");
-                            //const char* szPort = pComponent->queryProp( bMaster ? "@masterport" : "@slaveport");
                             StringBuffer szPort;
                             if (pComponent)
                                 szPort.append(pComponent->queryProp( bMaster ? "@masterport" : "@slaveport"));
@@ -1780,7 +1685,6 @@ void Cws_machineEx::enumerateRunningProcesses(CMachineInfoThreadParam* pParam,
                     }
                     //params typically is like "/c$/esp_dir/esp [parameters...]"
                     //so just pick the full path
-                    //
                     const char* pch = strchr(pszPath, ' ');
                     if (pch)
                     {
@@ -1802,13 +1706,9 @@ void Cws_machineEx::enumerateRunningProcesses(CMachineInfoThreadParam* pParam,
                 }
                 else
                 {
-#ifdef NO_RPM
-                    pszProcessName = pParam->m_bMultipleInstances ? pszPath : pszName;
-#else
                     const char* pszName0 = pParam->m_bMultipleInstances ? pszPath : pszName;
                     const char* pch = strrchr(pszName0, '/');
                     pszProcessName = pch ? pch+1 : pszName0;
-#endif
                 }
                 pRequiredProcesses->erase(pszProcessName);
             }
@@ -1823,7 +1723,6 @@ void Cws_machineEx::enumerateRunningProcesses(CMachineInfoThreadParam* pParam,
         //skip processes starting with '[' character on linux unless we are not
         //applying filters and have to return a complete list of processes.
         //On windows, skip [system process] regardless.
-        //
         if ((bLinuxInstance && (!bFilterProcesses || *pszName != '[')) ||
              (!bLinuxInstance && *pszName != '['))
       {
@@ -1893,11 +1792,9 @@ void Cws_machineEx::doGetStorageInfo(CMachineInfoThreadParam* pParam, IArrayOf<I
             Owned<IEspStorageInfo> info = static_cast<IEspStorageInfo*>(new CStorageInfo(""));
             pParam->addColumn( title );
             info->setDescription(title);
-            ///info->setType(storage->getType(temp).str());
             info->setTotal(total);
             info->setAvailable(available);
             info->setPercentAvail(percentAvail);
-            ///info->setFailures(storage->getFailures());
 
             output.append(*info.getLink());
         }
@@ -1920,7 +1817,6 @@ void Cws_machineEx::doGetProcessorInfo(CMachineInfoThreadParam* pParam, IArrayOf
     }
 
     Owned<IEspProcessorInfo> info = static_cast<IEspProcessorInfo*>(new CProcessorInfo(""));
-    //info->setType(processor->getType(temp).str());
     info->setLoad(cpuLoad);
 
     output.append(*info.getLink());
@@ -1949,7 +1845,6 @@ void Cws_machineEx::doGetSWRunInfo(IEspContext& context, CMachineInfoThreadParam
                                                 requiredProcesses);
             //now enumerate the processes running on this box and remove them from required processes
             //ignoring any non-required process
-            //
             if (runningProcesses.length() > 0)
             {
                 enumerateRunningProcesses( pParam, runningProcesses, bLinuxInstance, true, NULL, pidMap, &requiredProcesses);
@@ -1969,7 +1864,6 @@ void Cws_machineEx::doGetSWRunInfo(IEspContext& context, CMachineInfoThreadParam
 
                     info->setName(procName);
                     info->setInstances(0);
-                    DBGLOG("process down: name:<%s>", procName);
 
                     output.append(*info);
                 }
@@ -2005,12 +1899,9 @@ void Cws_machineEx::doGetSWRunInfo(IEspContext& context, CMachineInfoThreadParam
             for (; it1 != requiredProcesses.end(); it1++) //add in sorted order simply by traversing the map
             {
                 const char* procName = (*it1).c_str();
-                if (procName && *procName)
+                if (procName && *procName && !stricmp(procName, "dafilesrv"))
                 {
-                    if (!stricmp(procName, "dafilesrv"))
-                        bDafilesrvDown = true;
-
-                    DBGLOG("Need process: name:<%s>", procName);
+                    bDafilesrvDown = true;
                 }
             }
 
@@ -2019,10 +1910,9 @@ void Cws_machineEx::doGetSWRunInfo(IEspContext& context, CMachineInfoThreadParam
                 Linked<IEspSWRunInfo> info( (*it).second );
 
                 const char* procName = info->getName();
-                if (procName && *procName)
+                if (procName && *procName && !stricmp(procName, "dafilesrv"))
                 {
-                    if (!stricmp(procName, "dafilesrv"))
-                        bDafilesrvDown = false;
+                    bDafilesrvDown = false;
                 }
 
                 output.append( *info.getLink() );
@@ -2063,7 +1953,6 @@ void Cws_machineEx::doGetSWRunInfo(IEspContext& context, CMachineInfoThreadParam
     if (!bDafilesrvDown && machineInfo.m_sID.length() > 0)
     {
         //conditions: unknown, normal, warning, minor, major, critical, fatal
-        //
         pComponentInfo->setCondition( 1 );
         pComponentInfo->setState(5);
 
@@ -2092,7 +1981,6 @@ void Cws_machineEx::doGetSWRunInfo(IEspContext& context, CMachineInfoThreadParam
         pComponentInfo->setCondition(2); //Warnning
         pComponentInfo->setState(0);
 
-        //if (m_enableSNMP && bFilterProcesses)
         if (bFilterProcesses && (machineInfo.m_sID.length() < 1))
         {
             IEspSWRunInfo* info = static_cast<IEspSWRunInfo*>(new CSWRunInfo(""));
@@ -2115,7 +2003,6 @@ void Cws_machineEx::doGetSWRunInfo(IEspContext& context, CMachineInfoThreadParam
 
 //this method parses address info of the form "192.168.1.4-6:ThorSlaveProcess:thor1:2:path1"
 //into respective components
-//
 void Cws_machineEx::parseProperties(const char* info, StringBuffer& processType, StringBuffer& sCompName,
                                                 OpSysType& os, StringBuffer& path)
 {
@@ -2206,7 +2093,6 @@ const char* Cws_machineEx::lookupProcessname(const StringBuffer& sProcessType)
 //---------------------------------------------------------------------------
 //  GetDisplayProcessName
 //---------------------------------------------------------------------------
-/*static*/
 const char* Cws_machineEx::GetDisplayProcessName(const char* processName, char* buf)
 {
    //produces "LDAPServerProcess" as "LDAP Server" and "EspService" as "Esp Service", etc.
@@ -2314,7 +2200,6 @@ void Cws_machineEx::getMachineList(IConstEnvironment* constEnv, IPropertyTree* e
 {
     StringBuffer directoryStr = directory;
     Owned<IPropertyTreeIterator> machines= envRoot->getElements(machineType);
-    //const char* nodenametag = getNodeNameTag(MachineType);
     if (machines->first()) 
     {
         do 
@@ -2368,7 +2253,6 @@ void Cws_machineEx::getMachineList(IConstEnvironment* constEnv, IPropertyTree* e
                 else
                     name.append(name0);
                 
-                //machine.setType(type);
                 Owned<IConstMachineInfo> pMachineInfo =  constEnv->getMachine(name0);
                 if (pMachineInfo.get())
                 {
@@ -2389,11 +2273,7 @@ void Cws_machineEx::getMachineList(IConstEnvironment* constEnv, IPropertyTree* e
                         ipaddr.getIpText(ipStr);
                         if (ipStr.length() > 0)
                         {
-#ifdef MACHINE_IP
-                            netAddress.append(MACHINE_IP);
-#else
                             netAddress.append(ipStr.str());
-#endif
                             configNetAddress.append(".");
                         }
                     }
@@ -2666,7 +2546,6 @@ void Cws_machineEx::getTargetClusterProcesses(StringArray& targetClusters, Strin
                         dirStr.clear().append(eclCCServerProcess.queryProp("@directory"));
                     }
 
-                    //TODO
                     getMachineList(constEnv, pEnvironmentSoftware, process, eqEclCCServer, "", dirStr.str(), processAddresses);
                 }
             }
@@ -2697,7 +2576,6 @@ void Cws_machineEx::getTargetClusterProcesses(StringArray& targetClusters, Strin
                         dirStr.clear().append(eclAgentProcess.queryProp("@directory"));
                     }
 
-                    //TODO
                     getMachineList(constEnv, pEnvironmentSoftware, process, eqEclAgent, "", dirStr.str(), processAddresses);
                 }
             }
@@ -2728,7 +2606,6 @@ void Cws_machineEx::getTargetClusterProcesses(StringArray& targetClusters, Strin
                         dirStr.clear().append(eclSchedulerProcess.queryProp("@directory"));
                     }
 
-                    //TODO
                     getMachineList(constEnv, pEnvironmentSoftware, process, eqEclScheduler, "", dirStr.str(), processAddresses);
                 }
             }
@@ -2743,14 +2620,6 @@ void Cws_machineEx::getTargetClusterProcesses(StringArray& targetClusters, Strin
 bool Cws_machineEx::onGetTargetClusterInfo(IEspContext &context, IEspGetTargetClusterInfoRequest & req,
                                              IEspGetTargetClusterInfoResponse & resp)
 {
-#ifdef DETECT_WS_MC_MEM_LEAKS
-    static bool firstTime = true;
-    if (firstTime)
-    {
-        firstTime = false;
-        unsigned t = setAllocHook(true);
-    }
-#endif //DETECT_WS_MC_MEM_LEAKS
     try
     {
         if (!context.validateFeatureAccess(FEATURE_URL, SecAccess_Read, false))
@@ -2805,9 +2674,6 @@ bool Cws_machineEx::onGetTargetClusterInfo(IEspContext &context, IEspGetTargetCl
     {
         FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
-#ifdef DETECT_WS_MC_MEM_LEAKS
-    DBGLOG("Allocated=%d", setAllocHook(false));
-#endif //DETECT_WS_MC_MEM_LEAKS
 
     return true;
 }

+ 66 - 156
esp/services/ws_smc/ws_smcService.cpp

@@ -318,23 +318,7 @@ bool CWsSMCEx::onActivity(IEspContext &context, IEspActivityRequest &req, IEspAc
                 resp.setBannerScroll(m_BannerScroll.str());
             }
         }
-#if 0
-Owned<IEnvironmentFactory> envFactory = getEnvironmentFactory();
-Owned<IConstEnvironment> constEnv = envFactory->openEnvironmentByFile();
-Owned<IPropertyTree> root = &constEnv->getPTree();
-if (root)
-{
-StringBuffer buf;
-toXML(root, buf);
-if (buf.length() > 0)
-{
-    Owned<IFile> f = createIFile("new_env.xml");
-    Owned<IFileIO> fio = f->open(IFOcreaterw);
-    if (fio.get())
-        fio->write(0, buf.length(), buf.str());
-}
-}
-#endif
+
         Owned<IRemoteConnection> conn = querySDS().connect("/Status/Servers",myProcessSession(),RTM_LOCK_READ,30000);
 
         StringBuffer runningQueueNames[256];
@@ -421,13 +405,6 @@ if (buf.length() > 0)
                         {
                             if (wu->getStateID() == WUStateRunning)
                             {
-                                //StringBuffer buf;
-                                //toXML(pNode, buf);
-                                //if (buf.length() > 0)
-                                //{
-                                //  DBGLOG("CActiveWorkunitWrapper:%s", buf.str());
-                                //}
-
                                 int sg_duration = node.getPropInt("@sg_duration", -1);
                                 const char* graph = node.queryProp("@graph");
                                 int subgraph = node.getPropInt("@subgraph", -1);
@@ -588,7 +565,6 @@ if (buf.length() > 0)
                     color_type = 2;
                 }
                 returnCluster->setQueueStatus2(color_type);
-                DBGLOG("QueueStatus2=<%d>", color_type);
             }
 
             returnCluster->setDoCommand(doCommand);
@@ -661,8 +637,7 @@ if (buf.length() > 0)
                     returnCluster->setQueueStatus("running");
                 }
 
-                //returnCluster->setDoCommand(doCommand);
-                RoxieClusters.append(*returnCluster); //Temperary add here
+                RoxieClusters.append(*returnCluster);
             }
             resp.setRoxieClusters(RoxieClusters);
         }
@@ -710,105 +685,84 @@ if (buf.length() > 0)
             }
         }
 
-        int j = runningQueues;
-        while ( j > 0)
-        {
-            j--;
-            DBGLOG("runningQueueName=<%s>: runningJobs=<%d>", runningQueueNames[j].str(), runningJobsInQueue[j]);
-        }
-#if 0
-        Owned<IEnvironmentFactory> envFactory = getEnvironmentFactory();
-        envFactory->validateCache();
-
-        Owned<IConstEnvironment> constEnv = envFactory->openEnvironment();
-        Owned<IPropertyTree> pEnvRoot = &constEnv->getPTree();
-#else
         Owned<IPropertyTree> pEnvRoot = dummy.getEnvironment("");
         if (!pEnvRoot)
             throw MakeStringException(ECLWATCH_CANNOT_GET_ENV_INFO,"Failed to get environment information.");
-#endif
 
         StringBuffer dirxpath;
         dirxpath.append("Software/DfuServerProcess");
         Owned<IPropertyTreeIterator> services = pEnvRoot->getElements(dirxpath);
 
-        //Owned<IRemoteConnection> conn1 = querySDS().connect("/Environment/Software", myProcessSession(), RTM_LOCK_READ, SDS_LOCK_TIMEOUT);
-        //if (conn1)
-        {   
-            //IPropertyTree* pEnvSoftware = conn1->queryRoot();
-            //Owned<IPropertyTreeIterator> services= pEnvSoftware->getElements("DfuServerProcess");
-            if (services->first()) 
+        if (services->first())
+        {
+            do
             {
-                do 
+                IPropertyTree &serviceTree = services->query();
+                const char *queuename = serviceTree.queryProp("@queue");
+                if (queuename && *queuename)
                 {
-                    IPropertyTree &serviceTree = services->query();
-                    const char *queuename = serviceTree.queryProp("@queue");
-                    if (queuename && *queuename)
+                    StringArray queues;
+                    loop
                     {
-                        StringArray queues;
-                        loop
-                        {
-                            StringAttr subq;
-                            const char *comma = strchr(queuename,',');
-                            if (comma) 
-                                subq.set(queuename,comma-queuename);
-                            else
-                                subq.set(queuename);
-                            bool added;
-                            const char *s = strdup(subq.get());
-                            queues.bAdd(s, stringcmp, added);
-                            if (!added)
-                                free((void *)s);
-                            if (!comma)
-                                break;
-                            queuename = comma+1;
-                            if (!*queuename)
-                                break;
-                        }
-                        ForEachItemIn(q, queues)
+                        StringAttr subq;
+                        const char *comma = strchr(queuename,',');
+                        if (comma)
+                            subq.set(queuename,comma-queuename);
+                        else
+                            subq.set(queuename);
+                        bool added;
+                        const char *s = strdup(subq.get());
+                        queues.bAdd(s, stringcmp, added);
+                        if (!added)
+                            free((void *)s);
+                        if (!comma)
+                            break;
+                        queuename = comma+1;
+                        if (!*queuename)
+                            break;
+                    }
+                    ForEachItemIn(q, queues)
+                    {
+                        const char *queuename = queues.item(q);
+                        StringAttrArray wulist;
+                        unsigned running = queuedJobs(queuename, wulist);
+                        ForEachItemIn(i, wulist)
                         {
-                            const char *queuename = queues.item(q);
-                            StringAttrArray wulist;
-                            unsigned running = queuedJobs(queuename, wulist);
-                            ForEachItemIn(i, wulist)
+                            const char *wuid = wulist.item(i).text.get();
+                            try
                             {
-                                const char *wuid = wulist.item(i).text.get();
-                                try
-                                {
-                                    StringBuffer jname, uname, state;
-                                    Owned<IConstDFUWorkUnit> wu = getDFUWorkUnitFactory()->openWorkUnit(wuid, false);
-                                    if (wu)
-                                    {
-                                        wu->getUser(uname);
-                                        wu->getJobName(jname);
-                                        if (i<running)
-                                            state.append("running");
-                                        else
-                                            state.append("queued");
-
-                                        Owned<IEspActiveWorkunit> wu1(new CActiveWorkunitWrapper(wuid, uname.str(), jname.str(), state.str(), "normal"));
-                                        wu1->setServer("DFUserver");
-                                        wu1->setInstance(queuename);
-                                        wu1->setQueueName(queuename);
-                                    
-                                        aws.append(*wu1.getLink());
-                                    }
-                                }
-                                catch (IException *e)
+                                StringBuffer jname, uname, state;
+                                Owned<IConstDFUWorkUnit> wu = getDFUWorkUnitFactory()->openWorkUnit(wuid, false);
+                                if (wu)
                                 {
-                                    StringBuffer msg;
-                                    Owned<IEspActiveWorkunit> wu1(new CActiveWorkunitWrapper(wuid, "", "", e->errorMessage(msg).str(), "normal"));
+                                    wu->getUser(uname);
+                                    wu->getJobName(jname);
+                                    if (i<running)
+                                        state.append("running");
+                                    else
+                                        state.append("queued");
+
+                                    Owned<IEspActiveWorkunit> wu1(new CActiveWorkunitWrapper(wuid, uname.str(), jname.str(), state.str(), "normal"));
                                     wu1->setServer("DFUserver");
                                     wu1->setInstance(queuename);
                                     wu1->setQueueName(queuename);
-                                    
+
                                     aws.append(*wu1.getLink());
                                 }
                             }
+                            catch (IException *e)
+                            {
+                                StringBuffer msg;
+                                Owned<IEspActiveWorkunit> wu1(new CActiveWorkunitWrapper(wuid, "", "", e->errorMessage(msg).str(), "normal"));
+                                wu1->setServer("DFUserver");
+                                wu1->setInstance(queuename);
+                                wu1->setQueueName(queuename);
+                                aws.append(*wu1.getLink());
+                            }
                         }
                     }
-                } while (services->next());
-            }
+                }
+            } while (services->next());
         }
         resp.setThorClusters(ThorClusters);
         resp.setRunning(aws);
@@ -854,45 +808,6 @@ if (buf.length() > 0)
             }
         }
 
-#if 0 // handled by queuedJobs list already 
-        conn.setown(querySDS().connect("DFU/WorkUnits",myProcessSession(),0, INFINITE));
-        if (conn) 
-        {
-            Owned<IPropertyTreeIterator> it(conn->getElements("*[Recovery/Running]"));
-            ForEach(*it) 
-            {
-                IPropertyTree &e=it->query();
-                IPropertyTree *recovery  = e.queryPropTree("Recovery");
-                if (recovery) 
-                {
-                    if (recovery->getPropBool("Running",false)) 
-                    {
-                        unsigned done;
-                        unsigned total;
-                        countProgress(recovery,done,total);
-
-                        Owned<IEspDFUJob> job = new CDFUJob("","");
-
-                        job->setTimeStarted(e.queryProp("Progress/@timestarted"));
-                        job->setDone(done);
-                        job->setTotal(total);
-
-                        StringBuffer cmd;
-                        cmd.append(e.queryName());
-                        const char *user = e.queryProp("@submitID");
-                        if (user)
-                            cmd.append(" (").append(user).append(')');
-
-                        job->setCommand(cmd.str());
-
-                        jobs.append(*job.getLink());
-
-                    }
-                }
-            }
-        }
-#endif
-
         resp.setDFUJobs(jobs);
     }
     catch(IException* e)
@@ -907,7 +822,6 @@ if (buf.length() > 0)
 void CWsSMCEx::addCapabilities(IPropertyTree* pFeatureNode, const char* access, 
                                          IArrayOf<IEspCapability>& capabilities)
 {
-    //get [Read|Write|Full]/Capability nodes under the feature node based on access value
     StringBuffer xpath(access);
     xpath.append("/Capability");
 
@@ -997,8 +911,6 @@ bool CWsSMCEx::onMoveJobBack(IEspContext &context, IEspSMCJobRequest &req, IEspS
         unsigned index=queue->findRank(req.getWuid());
         if(index<queue->ordinality())
         {
-        //  if(!queue->moveToTail(req.getWuid()))
-        //      throw MakeStringException(0,"Failed to move %s",req.getWuid());
             int priority0 = queue->getItem(index)->getPriority();
             unsigned biggestIndoxInSamePriority = index;
             unsigned nextIndex = biggestIndoxInSamePriority + 1;
@@ -1042,8 +954,6 @@ bool CWsSMCEx::onMoveJobFront(IEspContext &context, IEspSMCJobRequest &req, IEsp
         unsigned index=queue->findRank(req.getWuid());
         if(index>0 && index<queue->ordinality())
         {
-            //if(!queue->moveToHead(req.getWuid()))
-            //  throw MakeStringException(0,"Failed to move %s",req.getWuid());
             int priority0 = queue->getItem(index)->getPriority();
             unsigned smallestIndoxInSamePriority = index;
             int nextIndex = smallestIndoxInSamePriority - 1;
@@ -1371,7 +1281,7 @@ bool CWsSMCEx::onBrowseResources(IEspContext &context, IEspBrowseResourcesReques
         const char* ossInstall = pEnvRoot->queryProp("EnvSettings/path");
         if (!ossInstall || !*ossInstall)
         {
-            DBGLOG("Failed to get EnvSettings/Path in environment settings.");
+            WARNLOG("Failed to get EnvSettings/Path in environment settings.");
             return true;
         }
 
@@ -1380,14 +1290,14 @@ bool CWsSMCEx::onBrowseResources(IEspContext &context, IEspBrowseResourcesReques
         Owned<IFile> f = createIFile(path.str());
         if(!f->exists() || !f->isDirectory())
         {
-            DBGLOG("Invalid resource folder");
+            WARNLOG("Invalid resource folder");
             return true;
         }
 
         Owned<IDirectoryIterator> di = f->directoryFiles(NULL, false, true);
         if(di.get() == NULL)
         {
-            DBGLOG("Resource folder is empty.");
+            WARNLOG("Resource folder is empty.");
             return true;
         }
 
@@ -1405,14 +1315,14 @@ bool CWsSMCEx::onBrowseResources(IEspContext &context, IEspBrowseResourcesReques
             Owned<IFile> f0 = createIFile(path0.str());
             if(!f0->exists())
             {
-                DBGLOG("Description file not found for %s", folder.str());
+                WARNLOG("Description file not found for %s", folder.str());
                 continue;
             }
 
             OwnedIFileIO rIO = f0->openShared(IFOread,IFSHfull);
             if(!rIO)
             {
-                DBGLOG("Failed to open the description file for %s", folder.str());
+                WARNLOG("Failed to open the description file for %s", folder.str());
                 continue;
             }
 
@@ -1423,21 +1333,21 @@ bool CWsSMCEx::onBrowseResources(IEspContext &context, IEspBrowseResourcesReques
             size32_t nRead = rIO->read(0, (size32_t) fileSize, (char*)tmpBuf.str());
             if (nRead != fileSize)
             {
-                DBGLOG("Failed to read the description file for %s", folder.str());
+                WARNLOG("Failed to read the description file for %s", folder.str());
                 continue;
             }
 
             Owned<IPropertyTree> desc = createPTreeFromXMLString(tmpBuf.str());
             if (!desc)
             {
-                DBGLOG("Invalid description file for %s", folder.str());
+                WARNLOG("Invalid description file for %s", folder.str());
                 continue;
             }
 
             Owned<IPropertyTreeIterator> fileIterator = desc->getElements("file");
             if (!fileIterator->first())
             {
-                DBGLOG("Invalid description file for %s", folder.str());
+                WARNLOG("Invalid description file for %s", folder.str());
                 continue;
             }
 

+ 0 - 51
esp/services/ws_topology/ws_topologyService.cpp

@@ -101,13 +101,10 @@ bool CWsTopologyEx::onTpSwapNode(IEspContext &context,IEspTpSwapNodeRequest  &re
 {
     try
     {
-        DBGLOG("CWsTopologyEx::onTpSwapNode\n");
-
         if (!context.validateFeatureAccess(FEATURE_URL, SecAccess_Full, false))
             throw MakeStringException(ECLWATCH_TOPOLOGY_ACCESS_DENIED, "Failed to Swap Node. Permission denied.");
 
         //another client (like configenv) may have updated the constant environment so reload it
-        //
         m_envFactory->validateCache();
 
         resp.setTpSwapNodeResult(false);
@@ -137,8 +134,6 @@ bool CWsTopologyEx::onTpSetMachineStatus(IEspContext &context,IEspTpSetMachineSt
 {
     try
     {
-        DBGLOG("CWsTopologyEx::onTpSetMachineStatus\n");
-
         if (!context.validateFeatureAccess(FEATURE_URL, SecAccess_Write, false))
             throw MakeStringException(ECLWATCH_TOPOLOGY_ACCESS_DENIED, "Failed to Set Machine Status. Permission denied.");
 
@@ -162,8 +157,6 @@ bool CWsTopologyEx::onTpLogFile(IEspContext &context,IEspTpLogFileRequest  &req,
 {
     try
     {
-        DBGLOG("CWsTopologyEx::onTpLogFile\n");
-
         if (!context.validateFeatureAccess(FEATURE_URL, SecAccess_Read, false))
             throw MakeStringException(ECLWATCH_TOPOLOGY_ACCESS_DENIED, "Failed to get Log File. Permission denied.");
 
@@ -198,12 +191,6 @@ bool CWsTopologyEx::onTpLogFile(IEspContext &context,IEspTpLogFileRequest  &req,
                 toHour[1] = readLogReq.endDate.charAt(12);
                 lastHours = atoi(toHour)-atoi(fromHour);
             }
-#if 0
-            else if (readLogReq.filterType == 4)
-            {
-                readLogReq.pageNumber --;
-            }
-#endif
             else if (readLogReq.filterType == 6) //from date/time to date/time
             {
                 if (readLogReq.startDate.length() < 19 && readLogReq.endDate.length() < 19)
@@ -380,12 +367,6 @@ bool CWsTopologyEx::onTpLogFile(IEspContext &context,IEspTpLogFileRequest  &req,
                     }
                 }
             }
-#if 0
-            if (readLogReq.filterType == 4)
-            {
-                readLogReq.pageNumber++;
-            }
-#endif
             if (readLogReq.fileSize > 0)
                 resp.setFileSize(readLogReq.fileSize);
             if (readLogReq.pageNumber > 0)
@@ -424,7 +405,6 @@ bool CWsTopologyEx::onSystemLog(IEspContext &context,IEspSystemLogRequest  &req,
 {
     try
     {
-        DBGLOG("CWsTopologyEx::onSystemLog\n");
         if (!context.validateFeatureAccess(FEATURE_URL, SecAccess_Read, false))
             throw MakeStringException(ECLWATCH_TOPOLOGY_ACCESS_DENIED, "Failed to get Log File. Permission denied.");
 
@@ -471,7 +451,6 @@ bool CWsTopologyEx::onSystemLog(IEspContext &context,IEspSystemLogRequest  &req,
         }
 
         headerStr.appendf("attachment;filename=%s", fileName.str());
-        //StringBuffer headerStr0 = headerStr;
         if (nZip > 2)
             headerStr.append(".gz");
         else if (nZip > 1)
@@ -576,8 +555,6 @@ bool CWsTopologyEx::onTpXMLFile(IEspContext &context,IEspTpXMLFileRequest  &req,
 {
     try
     {
-        DBGLOG("CWsTopologyEx::onTpXMLFile\n");
-
         if (!context.validateFeatureAccess(FEATURE_URL, SecAccess_Read, false))
             throw MakeStringException(ECLWATCH_TOPOLOGY_ACCESS_DENIED, "Failed to get Configuration File. Permission denied.");
 
@@ -599,14 +576,12 @@ bool CWsTopologyEx::onTpXMLFile(IEspContext &context,IEspTpXMLFileRequest  &req,
 
 void CWsTopologyEx::getThorXml(const char *cluster,StringBuffer& returnStr)
 {
-    DBGLOG("CWsTopologyEx::getThorXml\n");
     CCluster conn(cluster);
     toXML(conn->queryRoot(), returnStr);
 }
 
 void CWsTopologyEx::getThorLog(const char *cluster,MemoryBuffer& returnbuff)
 {
-    DBGLOG("CWsTopologyEx::getThorLog\n");
     StringBuffer logname;
     logname.append(CCluster(cluster)->queryRoot()->queryProp("LogFile"));
 
@@ -674,8 +649,6 @@ void CWsTopologyEx::readLogFile(StringBuffer logname, ReadLog& readLogReq, Strin
 
     if (readLogReq.filterType == 0 || readLogReq.filterType == 4) //by page number: 0 to n-1
     {
-        //if (readLogReq.pageNumber > readLogReq.TotalPages - 1)
-        //  readLogReq.pageNumber = readLogReq.TotalPages - 1;
         offset_t readFrom = LOGFILESIZELIMIT * readLogReq.pageNumber;
         if (readFrom > readLogReq.fileSize) 
             readFrom = 0;
@@ -1176,13 +1149,10 @@ bool CWsTopologyEx::onTpClusterQuery(IEspContext &context, IEspTpClusterQueryReq
 {
     try
     {
-        DBGLOG("CWsTopologyEx::onTpClusterQuery\n");
-
         if (!context.validateFeatureAccess(FEATURE_URL, SecAccess_Read, false))
             throw MakeStringException(ECLWATCH_TOPOLOGY_ACCESS_DENIED, "Failed to do Cluster Query. Permission denied.");
 
         //another client (like configenv) may have updated the constant environment so reload it
-        //
         m_envFactory->validateCache();
 
         IArrayOf<IEspTpCluster> clusters;
@@ -1216,8 +1186,6 @@ bool CWsTopologyEx::onTpTargetClusterQuery(IEspContext &context, IEspTpTargetClu
 {
     try
     {
-        DBGLOG("CWsTopologyEx::onTpTargetClusterQuery\n");
-
         if (!context.validateFeatureAccess(FEATURE_URL, SecAccess_Read, false))
             throw MakeStringException(ECLWATCH_TOPOLOGY_ACCESS_DENIED, "Failed to do Cluster Query. Permission denied.");
 
@@ -1267,8 +1235,6 @@ bool CWsTopologyEx::onTpLogicalClusterQuery(IEspContext &context, IEspTpLogicalC
 {
     try
     {
-        DBGLOG("CWsTopologyEx::onTpLogicalClusterQuery\n");
-
         if (!context.validateFeatureAccess(FEATURE_URL, SecAccess_Read, false))
             throw MakeStringException(ECLWATCH_TOPOLOGY_ACCESS_DENIED, "Failed to do Cluster Query. Permission denied.");
 
@@ -1311,8 +1277,6 @@ bool CWsTopologyEx::onTpGroupQuery(IEspContext &context, IEspTpGroupQueryRequest
 {
     try
     {
-        DBGLOG("CWsTopologyEx::onTpGroupQuery\n");
-
         if (!context.validateFeatureAccess(FEATURE_URL, SecAccess_Read, false))
             throw MakeStringException(ECLWATCH_TOPOLOGY_ACCESS_DENIED, "Failed to do Group Query. Permission denied.");
 
@@ -1332,8 +1296,6 @@ bool CWsTopologyEx::onTpClusterInfo(IEspContext &context, IEspTpClusterInfoReque
 {
     try
     {
-        DBGLOG("CWsTopologyEx::onTpClusterInfo\n");
-
         if (!context.validateFeatureAccess(FEATURE_URL, SecAccess_Read, false))
             throw MakeStringException(ECLWATCH_TOPOLOGY_ACCESS_DENIED, "Failed to get Cluster Information. Permission denied.");
 
@@ -1396,7 +1358,6 @@ bool CWsTopologyEx::onTpServiceQuery(IEspContext &context, IEspTpServiceQueryReq
         if (!type || !*type || (strcmp(eqAllServices,type) == 0))
         {
             //another client (like configenv) may have updated the constant environment so reload it
-            //
             m_envFactory->validateCache();
 
             IEspTpServices& ServiceList = resp.updateServiceList();
@@ -1450,10 +1411,7 @@ bool CWsTopologyEx::onTpMachineQuery(IEspContext &context, IEspTpMachineQueryReq
 { 
     try
     {
-        DBGLOG("CWsTopologyEx::onTpMachineQuery\n");
-
         //another client (like configenv) may have updated the constant environment so reload it
-        //
         m_envFactory->validateCache();
 
         if (!context.validateFeatureAccess(FEATURE_URL, SecAccess_Read, false))
@@ -1607,20 +1565,14 @@ bool CWsTopologyEx::onTpGetComponentFile(IEspContext &context,
                         
         
         //the paths are all windows or samba network shares so construct windows network path
-        //
         StringBuffer netAddressStr;
         SCMStringBuffer scmNetAddress;
         StringAttr      sDirectory;
         if (bCluster && !(netAddress && *netAddress))
         {
             //another client (like configenv) may have updated the constant environment so reload it
-            //
             m_envFactory->validateCache();
-#if 0
-            Owned<IConstEnvironment> constEnv = m_envFactory->openEnvironment();
-#else
             Owned<IConstEnvironment> constEnv = m_envFactory->openEnvironmentByFile();
-#endif
             Owned<IPropertyTree> pRoot = &constEnv->getPTree();
 
             StringBuffer xpath;
@@ -1667,9 +1619,6 @@ bool CWsTopologyEx::onTpGetComponentFile(IEspContext &context,
                 }
             }
         }
-#ifdef MACHINE_IP
-        netAddressStr.clear().append(MACHINE_IP);
-#endif
 
         if (netAddressStr.length() > 0)
             netAddress = netAddressStr.str();