Improved readability of action status messages that are created by the

update server itself.

Signed-off-by: Kai Zimmermann <kai.zimmermann@bosch-si.com>
This commit is contained in:
Kai Zimmermann
2016-05-03 15:56:16 +02:00
parent 7c4351faa5
commit f32f612e83
3 changed files with 20 additions and 12 deletions

View File

@@ -63,6 +63,8 @@ public class ControllerManagement {
private static final Logger LOG = LoggerFactory.getLogger(ControllerManagement.class);
private static final Logger LOG_DOS = LoggerFactory.getLogger("server-security.dos");
public static final String SERVER_MESSAGE_PREFIX = "Update Server: ";
@Autowired
private EntityManager entityManager;
@@ -341,13 +343,14 @@ public class ControllerManagement {
break;
case CANCELED:
case FINISHED:
// in case of successful cancelation we also report the success at
// in case of successful cancellation we also report the success at
// the canceled action itself.
actionStatus.addMessage("Cancelation completion is finished sucessfully.");
actionStatus.addMessage(
ControllerManagement.SERVER_MESSAGE_PREFIX + "Cancellation completion is finished sucessfully.");
deploymentManagement.successCancellation(action);
break;
case RETRIEVED:
actionStatus.addMessage("Cancelation request retrieved");
actionStatus.addMessage(ControllerManagement.SERVER_MESSAGE_PREFIX + "Cancellation request retrieved.");
break;
default:
}

View File

@@ -143,9 +143,11 @@ public class ArtifactStoreController {
actionStatus.setStatus(Status.DOWNLOAD);
if (range != null) {
actionStatus.addMessage("It is a partial download request: " + range);
actionStatus.addMessage(ControllerManagement.SERVER_MESSAGE_PREFIX + "Target downloads range " + range
+ " of: " + request.getRequestURI());
} else {
actionStatus.addMessage("Target downloads");
actionStatus.addMessage(
ControllerManagement.SERVER_MESSAGE_PREFIX + "Target downloads: " + request.getRequestURI());
}
controllerManagement.addActionStatusMessage(actionStatus);
return action;

View File

@@ -216,9 +216,11 @@ public class RootController {
statusMessage.setStatus(Status.DOWNLOAD);
if (range != null) {
statusMessage.addMessage("It is a partial download request: " + range);
statusMessage.addMessage(ControllerManagement.SERVER_MESSAGE_PREFIX + "Target downloads range " + range
+ " of: " + request.getRequestURI());
} else {
statusMessage.addMessage("Controller downloads");
statusMessage.addMessage(
ControllerManagement.SERVER_MESSAGE_PREFIX + "Target downloads: " + request.getRequestURI());
}
controllerManagement.addActionStatusMessage(statusMessage);
return action;
@@ -388,13 +390,13 @@ public class RootController {
LOG.debug("Controller confirmed cancel (actionid: {}, targetid: {}) as we got {} report.", actionid,
targetid, feedback.getStatus().getExecution());
actionStatus.setStatus(Status.CANCELED);
actionStatus.addMessage("Controller confirmed cancelation");
actionStatus.addMessage(ControllerManagement.SERVER_MESSAGE_PREFIX + "Target confirmed cancelation");
break;
case REJECTED:
LOG.info("Controller reported internal error (actionid: {}, targetid: {}) as we got {} report.", actionid,
targetid, feedback.getStatus().getExecution());
actionStatus.setStatus(Status.WARNING);
actionStatus.addMessage("Controller reported internal ERROR and REJECTED update.");
actionStatus.addMessage(ControllerManagement.SERVER_MESSAGE_PREFIX + "Target REJECTED update.");
break;
case CLOSED:
handleClosedUpdateStatus(feedback, targetid, actionid, actionStatus);
@@ -421,7 +423,8 @@ public class RootController {
LOG.debug("Controller reported intermediate status (actionid: {}, targetid: {}) as we got {} report.", actionid,
targetid, feedback.getStatus().getExecution());
actionStatus.setStatus(Status.RUNNING);
actionStatus.addMessage("Controller reported: " + feedback.getStatus().getExecution());
actionStatus.addMessage(
ControllerManagement.SERVER_MESSAGE_PREFIX + "Target reported: " + feedback.getStatus().getExecution());
}
private static void handleClosedUpdateStatus(final ActionFeedback feedback, final String targetid,
@@ -430,10 +433,10 @@ public class RootController {
feedback.getStatus().getExecution());
if (feedback.getStatus().getResult().getFinished() == FinalResult.FAILURE) {
actionStatus.setStatus(Status.ERROR);
actionStatus.addMessage("Controller reported CLOSED with ERROR!");
actionStatus.addMessage(ControllerManagement.SERVER_MESSAGE_PREFIX + "Target reported CLOSED with ERROR!");
} else {
actionStatus.setStatus(Status.FINISHED);
actionStatus.addMessage("Controller reported CLOSED with OK!");
actionStatus.addMessage(ControllerManagement.SERVER_MESSAGE_PREFIX + "Target reported CLOSED with OK!");
}
}