Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HPCC-30628 Add initNullConfiguration for CLI's without configuration #17941

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions dali/dalidiag/dalidiag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,8 @@ int main(int _argc, char* argv[])
}

try {
initNullConfiguration();

Owned<IGroup> group = createIGroup(epa);
assertex(group);
initClientProcess(group, DCR_DaliDiag, 0, NULL, NULL, MP_WAIT_FOREVER);
Expand Down
31 changes: 20 additions & 11 deletions dali/dalistop/dalistop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@
#include "daclient.hpp"


static void usage()
{
printf("usage: dalistop <server_ip:port> [/nowait]\n");
printf("eg: dalistop . -- stop dali server running locally\n");
printf(" dalistop eq0001016 -- stop dali server running remotely\n");
}

int main(int argc, const char* argv[])
{
InitModuleObjects();
Expand All @@ -34,23 +41,25 @@ int main(int argc, const char* argv[])
const char *server = nullptr;
if (argc<2)
{
// with no args, use port from daliconfig if present (used by init scripts)
Owned<IFile> daliConfigFile = createIFile("daliconf.xml");
if (daliConfigFile->exists())
{
Owned<IPropertyTree> daliConfig = createPTree(*daliConfigFile, ipt_caseInsensitive);
port = daliConfig->getPropInt("@port", DALI_SERVER_PORT);
server = ".";
}
if (isContainerized())
usage();
else
{
printf("usage: dalistop <server_ip:port> [/nowait]\n");
printf("eg: dalistop . -- stop dali server running locally\n");
printf(" dalistop eq0001016 -- stop dali server running remotely\n");
// with no args, use port from daliconfig if present (used by init scripts)
Owned<IFile> daliConfigFile = createIFile("daliconf.xml");
if (daliConfigFile->exists())
{
Owned<IPropertyTree> daliConfig = createPTree(*daliConfigFile, ipt_caseInsensitive);
port = daliConfig->getPropInt("@port", DALI_SERVER_PORT);
server = ".";
}
else
usage();
}
}
else
{
initNullConfiguration();
server = argv[1];
port = DALI_SERVER_PORT;
}
Expand Down
2 changes: 2 additions & 0 deletions dali/sasha/sasha.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,8 @@ int main(int argc, char* argv[])
EnableSEHtoExceptionMapping();
Thread::setDefaultStackSize(0x10000);
try {
initNullConfiguration();

startMPServer(0);
attachStandardFileLogMsgMonitor("sasha.log", NULL, MSGFIELD_STANDARD, MSGAUD_all, MSGCLS_all, TopDetail, LOGFORMAT_table, true);
queryStderrLogMsgHandler()->setMessageFields(MSGFIELD_prefix);
Expand Down
8 changes: 8 additions & 0 deletions system/jlib/jptree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9099,6 +9099,14 @@ void replaceComponentConfig(IPropertyTree *newComponentConfig, IPropertyTree *ne
executeConfigUpdaterCallbacks();
}

void initNullConfiguration()
{
if (componentConfiguration || globalConfiguration)
throw makeStringException(99, "Configuration has already been initialised");
componentConfiguration.setown(createPTree());
globalConfiguration.setown(createPTree());
}

class CYAMLBufferReader : public CInterfaceOf<IPTreeReader>
{
protected:
Expand Down
1 change: 1 addition & 0 deletions system/jlib/jptree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ jlib_decl IPropertyTree * loadArgsIntoConfiguration(IPropertyTree *config, const
jlib_decl IPropertyTree * loadConfiguration(IPropertyTree * defaultConfig, const char * * argv, const char * componentTag, const char * envPrefix, const char * legacyFilename, IPropertyTree * (mapper)(IPropertyTree *), const char *altNameAttribute=nullptr, bool monitor=true);
jlib_decl IPropertyTree * loadConfiguration(const char * defaultYaml, const char * * argv, const char * componentTag, const char * envPrefix, const char * legacyFilename, IPropertyTree * (mapper)(IPropertyTree *), const char *altNameAttribute=nullptr, bool monitor=true);
jlib_decl void replaceComponentConfig(IPropertyTree *newComponentConfig, IPropertyTree *newGlobalConfig);
jlib_decl void initNullConfiguration();
jlib_decl IPropertyTree * getCostsConfiguration();

//The following can only be called after loadConfiguration has been called. All components must call loadConfiguration().
Expand Down