if ((previousState == null) || (previousState != newState)) {
LivenessStateChange livenessChange = new LivenessStateChange(
machine, previousState, newState);
LOG.info("liveness state change: " + livenessChange);
Alert alert = livenessChange.toAlert();
if (livenessTestResult.getError().isPresent()) {
alert = alert.withTag("commandError", livenessTestResult
.getError().get().getMessage());
}
if (livenessTestResult.getCommandResult().isPresent()) {
SshCommandResult command = livenessTestResult
.getCommandResult().get();
alert = alert.withTag("commandExitCode",
String.valueOf(command.getExitStatus()));
alert = alert.withTag("commandStdout", command.getStdout());
alert = alert.withTag("commandStderr", command.getStderr());
}
this.eventBus.post(alert);
}
}