foundEnvs.add(r.getResult());
} else {
if (foundEnvs.isEmpty()) {
if (tenantLinks != null && !tenantLinks.isEmpty()) {
queryEnvironment(state, endpoint, null,
<BUG>networkProfileLinks, callbackFunction);
</BUG>
} else {
failTask(String.format(
"No available environments for endpoint %s of type %s",

foundEnvs.add(r.getResult());
} else {
if (foundEnvs.isEmpty()) {
if (tenantLinks != null && !tenantLinks.isEmpty()) {
queryEnvironment(state, endpoint, null,
environmentLinks, callbackFunction);
} else {
failTask(String.format(
"No available environments for endpoint %s of type %s",
