-
Notifications
You must be signed in to change notification settings - Fork 301
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-12426 Add WUQueryDetails option to list applicable WsEcl Addresses #6617
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1593,6 +1593,69 @@ bool CWsWorkunitsEx::onWUQueryDetails(IEspContext &context, IEspWUQueryDetailsRe | |
WsWuInfo winfo(context, wuid); | ||
resp.setResourceURLCount(winfo.getResourceURLCount()); | ||
} | ||
if (req.getIncludeWsEclAddresses()) | ||
{ | ||
StringBuffer daliAddress; | ||
if (!daliServers.isEmpty()) | ||
{ | ||
const char *finger = daliServers.get(); | ||
while (*finger && !strchr(":;,", *finger)) | ||
daliAddress.append(*finger++); | ||
} | ||
|
||
StringArray wseclAddresses; | ||
Owned<IEnvironmentFactory> factory = getEnvironmentFactory(); | ||
Owned<IConstEnvironment> env = factory->openEnvironment(); | ||
if (env) | ||
{ | ||
Owned<IPropertyTree> root = &env->getPTree(); | ||
Owned<IPropertyTreeIterator> services = root->getElements("Software/EspService[Properties/@type='ws_ecl']"); | ||
StringArray serviceNames; | ||
VStringBuffer xpath("Target[@name='%s']", querySet); | ||
ForEach(*services) | ||
{ | ||
IPropertyTree &service = services->query(); | ||
if (!service.hasProp("Target") || service.hasProp(xpath)) | ||
serviceNames.append(service.queryProp("@name")); | ||
} | ||
|
||
Owned<IPropertyTreeIterator> processes = root->getElements("Software/EspProcess"); | ||
ForEach(*processes) | ||
{ | ||
StringArray netAddrs; | ||
IPropertyTree &process = processes->query(); | ||
Owned<IPropertyTreeIterator> instances = process.getElements("Instance"); | ||
ForEach(*instances) | ||
{ | ||
IPropertyTree &instance = instances->query(); | ||
const char *netAddr = instance.queryProp("@netAddress"); | ||
if (!netAddr || !*netAddr) | ||
continue; | ||
if (streq(netAddr, ".") && daliAddress.length()) | ||
netAddrs.append(daliAddress); | ||
else | ||
netAddrs.append(netAddr); | ||
} | ||
Owned<IPropertyTreeIterator> bindings = process.getElements("EspBinding"); | ||
ForEach(*bindings) | ||
{ | ||
IPropertyTree &binding = bindings->query(); | ||
const char *srvName = binding.queryProp("@service"); | ||
if (!serviceNames.contains(srvName)) | ||
continue; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There can be >1 EspBinding with the same @server name ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, ESP supports it. I can bind the same service configuration to multiple ports and with different protocols. |
||
const char *port = binding.queryProp("@port"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shouldn't this be a getPropInt ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It definitely could be. I just use it to build a string so thought converting twice was wasteful. Should I switch to getPropInt? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nah fair enough, a comment perhaps that should always be an int. |
||
if (!port || !*port) | ||
continue; | ||
ForEachItemIn(i, netAddrs) | ||
{ | ||
VStringBuffer wseclAddr("%s:%s", netAddrs.item(i), port); | ||
wseclAddresses.append(wseclAddr); | ||
} | ||
} | ||
} | ||
} | ||
resp.setWsEclAddresses(wseclAddresses); | ||
} | ||
|
||
return true; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks odd - if netAddr = "." - then assume EspProcess/Instance is on dali node?
I'm not clear why you need to special case "." here, but if it is in the environment, then it surely means everything i, includes this esp node.
So you should probably use SocketEndpoint to resolve ".".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like that "." is used for a netAddress in the environment at all. Since the ESP running this code may be one with an explicitly configured address, while others have ".", I have to assume "." means the address of the dali. Weird but the safest way I think. If they move dali, they can't use "."... and then I'd be happier anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So you're thinking with environment with a mixture of "."'s and explicity netAddresses.. that would be weird..
I'm not sure what it means..
I think a comment at very least is needed, but really I think since "." means my local IP, it it SocketEndpoint(".") does not match your local IP - then I'd be temped to error with a mis-configuration issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I'll first think about looking up the computer reference rather than using the netAddress.