"Trusting the instance status {} from replica or instance for instance",
r.getStatus(), r.getId());
return r.getStatus();
}
// Overrides are the status like OUT_OF_SERVICE and UP set by NAC
InstanceStatus overridden = overriddenInstanceStatusMap.get(r.getId());
// If there are instance specific overrides, then they win - otherwise
// the ASG status
if (overridden != null) {
logger.debug(
"The instance specific override for instance {} and the value is {}",
r.getId(), overridden.name());
return overridden;
}
// If the ASGName is present- check for its status
boolean isASGDisabled = false;
if (r.getASGName() != null) {
isASGDisabled = !AwsAsgUtil.getInstance().isASGEnabled(
r.getASGName());
logger.debug("The ASG name is specified {} and the value is {}",
r.getASGName(), isASGDisabled);
if (isASGDisabled) {
return InstanceStatus.OUT_OF_SERVICE;
} else {
return InstanceStatus.UP;
}
}
// This is for backward compatibility until all applications have ASG
// names, otherwise while starting up
// the client status may override status replicated from other servers
if (!isReplication) {
InstanceStatus existingStatus = null;
if (existingLease != null) {
existingStatus = existingLease.getHolder().getStatus();
}
// Allow server to have its way when the status is UP or
// OUT_OF_SERVICE