} else {
boolean foundTarget = false;
List<LbConfig> lbConfigs = lbconfigs.getLbConfig();
for (LbConfig lc:lbConfigs) {
//ServerRef sRef = lc.getServerRefByRef(target);
ServerRef sRef = lc.getRefByRef(ServerRef.class, target);
if (sRef == null) {
//log a warning and continue search
logger.warning(localStrings.getLocalString("InvalidInstance",
"Server {0} does not exist in {1}", target, lc.getName()));
} else {
boolean enabled = sRef.getLbEnabled().equals("true");
if (enabled == true) {
String msg = localStrings.getLocalString("ServerEnabled",
"Server [{0}] is already enabled.", sRef.getRef());
report.setMessage(msg);
return;
}
try {
updateLbEnabled(sRef, "true", null);
} catch (TransactionFailure ex) {
String msg = localStrings.getLocalString("FailedToUpdateAttr",
"Failed to update lb-enabled attribute for {0}", target);
report.setMessage(msg);
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
report.setFailureCause(ex);
return;
}
foundTarget = true;
}
}
// did not find server target
if (!foundTarget) {
ServerRef sRef = getServerRefFromCluster(report, target);
if (sRef == null) {
String msg = localStrings.getLocalString("InvalidServer",
"Server {0} does not exist", target);
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
report.setMessage(msg);
return;
} else {
boolean enabled = sRef.getLbEnabled().equals("true");
if (enabled == true) {
String msg = localStrings.getLocalString("ServerEnabled",
"Server [{0}] is already enabled.", sRef.getRef());
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
report.setMessage(msg);
return;
}
try {