Skip to content

Commit

Permalink
Merge pull request #17776 from wangkx/h30218
Browse files Browse the repository at this point in the history
HPCC-30218 Use default spray target if not specified in cloud

Reviewed-by: Jake Smith <[email protected]>
Merged-by: Gavin Halliday <[email protected]>
  • Loading branch information
ghalliday authored Sep 18, 2023
2 parents 9c7ef25 + 66b29a3 commit dff3ece
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
7 changes: 5 additions & 2 deletions ecl/eclagent/eclagent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3128,8 +3128,11 @@ char * EclAgent::getClusterName()
char * EclAgent::getGroupName()
{
#ifdef _CONTAINERIZED
// in a containerized setup, the group is moving..
return strdup("unknown");
// In containerized there is no associated cluster group.
// Return an empty result instead, which if used for destinationGroup
// via Thorlib.group() as part of a fileservices call, will be interpreted
// as targeting the default data plane
return strdup("");
#else
StringBuffer groupName;
if (!isStandAloneExe)
Expand Down
17 changes: 13 additions & 4 deletions esp/services/ws_fs/ws_fsService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2083,15 +2083,24 @@ static void checkValidDfuQueue(const char * dfuQueue)
#endif
}

static const char* getSprayDestGroup(const char* groupReq, StringBuffer& groupOut)
{
if (!isEmptyString(groupReq))
groupOut.append(groupReq);
else if (isContainerized())
getDefaultStoragePlane(groupOut);
return groupOut.str();
}

bool CFileSprayEx::onSprayFixed(IEspContext &context, IEspSprayFixed &req, IEspSprayFixedResponse &resp)
{
try
{
context.ensureFeatureAccess(FILE_SPRAY_URL, SecAccess_Write, ECLWATCH_FILE_SPRAY_ACCESS_DENIED, "Failed to do Spray. Permission denied.");

StringBuffer destFolder, destTitle, defaultFolder, defaultReplicateFolder;
StringBuffer destFolder, destTitle, defaultFolder, defaultReplicateFolder, groupStr;

const char* destNodeGroup = req.getDestGroup();
const char* destNodeGroup = getSprayDestGroup(req.getDestGroup(), groupStr);
if (isEmptyString(destNodeGroup))
throw makeStringExceptionV(ECLWATCH_INVALID_INPUT, "Destination node group not specified.");

Expand Down Expand Up @@ -2246,9 +2255,9 @@ bool CFileSprayEx::onSprayVariable(IEspContext &context, IEspSprayVariable &req,
{
context.ensureFeatureAccess(FILE_SPRAY_URL, SecAccess_Write, ECLWATCH_FILE_SPRAY_ACCESS_DENIED, "Failed to do Spray. Permission denied.");

StringBuffer destFolder, destTitle, defaultFolder, defaultReplicateFolder;
StringBuffer destFolder, destTitle, defaultFolder, defaultReplicateFolder, groupStr;

const char* destNodeGroup = req.getDestGroup();
const char* destNodeGroup = getSprayDestGroup(req.getDestGroup(), groupStr);
if (isEmptyString(destNodeGroup))
throw makeStringExceptionV(ECLWATCH_INVALID_INPUT, "Destination node group not specified.");

Expand Down

0 comments on commit dff3ece

Please sign in to comment.