From 55eec125aa043916baaec73202758ae0e8f87d9e Mon Sep 17 00:00:00 2001 From: Jake Smith Date: Thu, 14 Dec 2023 15:39:53 +0000 Subject: [PATCH] HPCC-30848 Ensure globals are available in bare-metal esp Signed-off-by: Jake Smith --- esp/platform/espcfg.cpp | 12 ------------ esp/platform/espp.cpp | 11 +++++++++++ initfiles/componentfiles/configxml/esp.xsl | 3 +++ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/esp/platform/espcfg.cpp b/esp/platform/espcfg.cpp index 9f622b4e1ff..21a0fb87422 100644 --- a/esp/platform/espcfg.cpp +++ b/esp/platform/espcfg.cpp @@ -400,18 +400,6 @@ CEspConfig::CEspConfig(IProperties* inputs, IPropertyTree* envpt, IPropertyTree* if (sdsSessionNeeded && !daliservers.isEmpty()) initSDSSessionCleaner(isDetachedFromDali()); -#ifndef _CONTAINERIZED - // Copy the 'cost' tree as provided in environment.xml to the globalConfiguration IPropertyTree, - // so that it is available to the functions that calculate storage and workunit costs - // (Thor, hThor and eclagent are already using globalConfiguration, so this copying is not nessary anywhere else) - IPropertyTree * espConfigCost = m_envpt->queryPropTree("cost"); - if (espConfigCost) - { - Owned global = getGlobalConfig(); - IPropertyTree * cost = global->hasProp("cost") ? global->queryPropTree("cost") : global->addPropTree("cost"); - mergeConfiguration(*cost, *espConfigCost, nullptr, false); - } -#endif initializeStorageGroups(daliClientActive()); const unsigned dafilesrvConnectTimeout = m_cfg->getPropInt("@dafilesrvConnectTimeout", 10)*1000; diff --git a/esp/platform/espp.cpp b/esp/platform/espp.cpp index 734b9357016..18477717f7d 100644 --- a/esp/platform/espp.cpp +++ b/esp/platform/espp.cpp @@ -452,7 +452,18 @@ int init_main(int argc, const char* argv[]) else { envpt.setown(createPTreeFromXMLFile(cfgfile, ipt_caseInsensitive)); + + // NB: esp has no standard component config in bare-metal, this is loading defaultYaml only espConfig.setown(loadConfiguration(defaultYaml, argv, "esp", "ESP", nullptr, nullptr)); + + // legacy esp.xml will contain a generated global section if present in the environment. + // replace the empty stub created by loadConfiguration with this environment globals section. + Owned global = envpt->queryPropTree("global"); + if (global) + { + Owned currentConfig = getComponentConfig(); + replaceComponentConfig(currentConfig, global); + } } Owned procpt = NULL; if (envpt) diff --git a/initfiles/componentfiles/configxml/esp.xsl b/initfiles/componentfiles/configxml/esp.xsl index 369112c0b81..5be41c5e960 100644 --- a/initfiles/componentfiles/configxml/esp.xsl +++ b/initfiles/componentfiles/configxml/esp.xsl @@ -82,6 +82,9 @@ + + +