|
@@ -23,6 +23,7 @@
|
|
|
#include "daclient.hpp"
|
|
|
#include "dadfs.hpp"
|
|
|
#include "jencrypt.hpp"
|
|
|
+#include "confighelper.hpp"
|
|
|
|
|
|
#ifdef _WINDOWS
|
|
|
#include <winsock2.h>
|
|
@@ -31,8 +32,6 @@
|
|
|
|
|
|
#define STANDARD_CONFIG_BACKUPDIR CONFIG_DIR"/backup"
|
|
|
#define STANDARD_CONFIG_SOURCEDIR CONFIG_DIR
|
|
|
-#define STANDARD_CONFIG_BUILDSETFILE "buildset.xml"
|
|
|
-#define STANDARD_CONFIG_CONFIGXML_DIR "/componentfiles/configxml/"
|
|
|
#define STANDARD_CONFIG_STAGED_PATH "/etc/HPCCSystems/environment.xml"
|
|
|
|
|
|
#define DEFAULT_DIRECTORIES "<Directories name=\""DIR_NAME"\">\
|
|
@@ -196,58 +195,6 @@ void expandRange(IPropertyTree* pComputers)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-CConfigHelper::CConfigHelper()
|
|
|
-{
|
|
|
-}
|
|
|
-
|
|
|
-CConfigHelper::~CConfigHelper()
|
|
|
-{
|
|
|
-}
|
|
|
-
|
|
|
-void CConfigHelper::init(const IPropertyTree *cfg, const char* esp_name)
|
|
|
-{
|
|
|
- StringBuffer xpath;
|
|
|
-
|
|
|
- xpath.clear().appendf("%s/%s/%s[%s='%s']/%s",XML_TAG_SOFTWARE, XML_TAG_ESPPROCESS, XML_TAG_ESPSERVICE, XML_ATTR_NAME, esp_name, XML_TAG_LOCALCONFFILE);
|
|
|
- m_strConfFile = cfg->queryProp(xpath.str());
|
|
|
-
|
|
|
- xpath.clear().appendf("%s/%s/%s[%s='%s']/%s",XML_TAG_SOFTWARE, XML_TAG_ESPPROCESS, XML_TAG_ESPSERVICE, XML_ATTR_NAME, esp_name, XML_TAG_LOCALENVCONFFILE);
|
|
|
- m_strEnvConfFile = cfg->queryProp(xpath.str());
|
|
|
-
|
|
|
- if (m_strConfFile.length() > 0 && m_strEnvConfFile.length() > 0)
|
|
|
- {
|
|
|
- Owned<IProperties> pParams = createProperties(m_strConfFile);
|
|
|
- Owned<IProperties> pEnvParams = createProperties(m_strEnvConfFile);
|
|
|
-
|
|
|
- m_strConfigXMLDir = pEnvParams->queryProp(TAG_PATH);
|
|
|
-
|
|
|
- if ( m_strConfigXMLDir.length() == 0)
|
|
|
- {
|
|
|
- m_strConfigXMLDir = INSTALL_DIR;
|
|
|
- }
|
|
|
-
|
|
|
- m_strBuildSetFileName = pParams->queryProp(TAG_BUILDSET);
|
|
|
-
|
|
|
- m_strBuildSetFilePath.append(m_strConfigXMLDir).append(STANDARD_CONFIG_CONFIGXML_DIR).append( m_strBuildSetFileName.length() > 0 ? m_strBuildSetFileName : STANDARD_CONFIG_BUILDSETFILE);
|
|
|
- m_pDefBldSet.set(createPTreeFromXMLFile(m_strBuildSetFilePath.str()));
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-bool CConfigHelper::isInBuildSet(const char* comp_process_name, const char* comp_name) const
|
|
|
-{
|
|
|
- StringBuffer xpath;
|
|
|
-
|
|
|
- xpath.appendf("./%s/%s/%s[%s=\"%s\"][%s=\"%s\"]", XML_TAG_PROGRAMS, XML_TAG_BUILD, XML_TAG_BUILDSET, XML_ATTR_PROCESS_NAME, comp_process_name, XML_ATTR_NAME, comp_name);
|
|
|
-
|
|
|
- if (strcmp(XML_TAG_DIRECTORIES,comp_name) != 0 && m_pDefBldSet->queryPropTree(xpath.str()) == NULL)
|
|
|
- {
|
|
|
- return false;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
-}
|
|
|
|
|
|
CWsDeployExCE::~CWsDeployExCE()
|
|
|
{
|
|
@@ -298,12 +245,12 @@ void CWsDeployExCE::init(IPropertyTree *cfg, const char *process, const char *se
|
|
|
if (m_service.length() == 0)
|
|
|
m_service.append(service);
|
|
|
|
|
|
+ CConfigHelper::getInstance(cfg, service);
|
|
|
+
|
|
|
m_bCloud = false;
|
|
|
StringBuffer xpath;
|
|
|
m_envFile.clear();
|
|
|
|
|
|
- m_configHelper.init(cfg,service);
|
|
|
-
|
|
|
xpath.clear().appendf("Software/EspProcess/EspService[@name='%s']/LocalEnvConfFile", service);
|
|
|
const char* tmp = cfg->queryProp(xpath.str());
|
|
|
if (tmp && *tmp)
|
|
@@ -2989,11 +2936,14 @@ bool CWsDeployFileInfo::displaySettings(IEspContext &context, IEspDisplaySetting
|
|
|
const char* buildSetName = pBuildSet->queryProp(XML_ATTR_NAME);
|
|
|
const char* processName = pBuildSet->queryProp(XML_ATTR_PROCESS_NAME);
|
|
|
|
|
|
- if ( m_pService->m_configHelper.isInBuildSet(pszCompType,buildSetName) == false )
|
|
|
+ if ( CConfigHelper::getInstance()->isInBuildSet(pszCompType,buildSetName) == false )
|
|
|
{
|
|
|
throw MakeStringException(-1, "Component '%s' named '%s' not in build set. Component may be incompatible with the current version.", pszCompType, pszCompName);
|
|
|
}
|
|
|
|
|
|
+ StringArray sNewCompArray;
|
|
|
+ CConfigHelper::getInstance()->getNewComponentListFromBuildSet(pEnvRoot, sNewCompArray);
|
|
|
+
|
|
|
StringBuffer buildSetPath;
|
|
|
Owned<IPropertyTree> pSchema = loadSchema(pEnvRoot->queryPropTree("./Programs/Build[1]"), pBuildSet, buildSetPath, m_Environment);
|
|
|
|
|
@@ -4100,16 +4050,16 @@ bool CWsDeployFileInfo::handleComponent(IEspContext &context, IEspHandleComponen
|
|
|
|
|
|
StringBuffer xpath;
|
|
|
xpath.appendf("./Programs/Build/BuildSet[@name=\"%s\"]", buildSet);
|
|
|
- Owned<IPropertyTreeIterator> buildSetIter = pEnvRoot->getElements(xpath.str());
|
|
|
+ Owned<IPropertyTreeIterator> buildSetIter = CConfigHelper::getInstance()->getBuildSetTree()->getElements(xpath.str());
|
|
|
buildSetIter->first();
|
|
|
IPropertyTree* pBuildSet = &buildSetIter->query();
|
|
|
const char* buildSetName = pBuildSet->queryProp(XML_ATTR_NAME);
|
|
|
const char* processName = pBuildSet->queryProp(XML_ATTR_PROCESS_NAME);
|
|
|
|
|
|
StringBuffer buildSetPath;
|
|
|
- Owned<IPropertyTree> pSchema = loadSchema(pEnvRoot->queryPropTree("./Programs/Build[1]"), pBuildSet, buildSetPath, m_Environment);
|
|
|
+ Owned<IPropertyTree> pSchema = loadSchema(CConfigHelper::getInstance()->getBuildSetTree()->queryPropTree("./Programs/Build[1]"), pBuildSet, buildSetPath, m_Environment);
|
|
|
xpath.clear().appendf("./Software/%s[@name='%s']", processName, buildSetName);
|
|
|
- IPropertyTree* pCompTree = generateTreeFromXsd(pEnvRoot, pSchema, processName, buildSetName, m_pService->getCfg(), m_pService->getName(), false);
|
|
|
+ IPropertyTree* pCompTree = generateTreeFromXsd(CConfigHelper::getInstance()->getBuildSetTree(), pSchema, processName, buildSetName, m_pService->getCfg(), m_pService->getName(), false);
|
|
|
|
|
|
if (processName != NULL && strcmp(processName, XML_TAG_ROXIECLUSTER) == 0 && pCompTree->queryPropTree(XML_TAG_ROXIE_SERVER) != NULL)
|
|
|
pCompTree->removeTree(pCompTree->queryPropTree(XML_TAG_ROXIE_SERVER));
|
|
@@ -4120,6 +4070,7 @@ bool CWsDeployFileInfo::handleComponent(IEspContext &context, IEspHandleComponen
|
|
|
pCompTree->removeTree(pInstTree);
|
|
|
|
|
|
addComponentToEnv(pEnvRoot, buildSet, sbNewName, pCompTree);
|
|
|
+ CConfigHelper::getInstance()->addNewComponentsFromBuildSetToEnv(pEnvRoot);
|
|
|
}
|
|
|
|
|
|
resp.setCompName(sbNewName.str());
|
|
@@ -6321,20 +6272,6 @@ void CWsDeployFileInfo::initFileInfo(bool createOrOverwrite, bool bClearEnv)
|
|
|
StringBuffer s("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Environment></Environment>");
|
|
|
Owned<IPropertyTree> pNewTree = createPTreeFromXMLString(s);
|
|
|
|
|
|
- if ( strlen(m_pService->m_configHelper.getBuildSetFilePath()) > 0 )
|
|
|
- {
|
|
|
- try
|
|
|
- {
|
|
|
- Owned<IPropertyTree> pDefBldSet = createPTreeFromXMLFile( m_pService->m_configHelper.getBuildSetFilePath() );
|
|
|
- pNewTree->addPropTree(XML_TAG_PROGRAMS, createPTreeFromIPT(pDefBldSet->queryPropTree("./Programs")));
|
|
|
- pNewTree->addPropTree(XML_TAG_SOFTWARE, createPTreeFromIPT(pDefBldSet->queryPropTree("./Software")));
|
|
|
- }
|
|
|
- catch(IException* e)
|
|
|
- {
|
|
|
- e->Release();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
if(!pNewTree->queryPropTree(XML_TAG_SOFTWARE))
|
|
|
{
|
|
|
pNewTree->addPropTree(XML_TAG_SOFTWARE, createPTree());
|