public void run() { try { execute(); if (!action.getStatus().getState().equals(com.redhat.rhevm.api.model.CreationStatus.FAILED.value())) { action.setStatus(StatusUtils.create(com.redhat.rhevm.api.model.CreationStatus.COMPLETE)); } } catch (Throwable t) { String message = t.getMessage() != null ? t.getMessage() : t.getClass().getName(); setFault(MessageFormat.format(t.getCause() != null ? t.getCause().getMessage() : reason, message), t); } }
protected void display(Action action) throws Exception { System.out.print("[" + getLink(action.getLink(), "replay")); System.out.println("] " + action.getStatus()); if (Status.FAILED.equals(action.getStatus()) && action.isSetFault()) { System.out.println("[" + action.getFault().getReason() + "]"); if (detail) { System.out.println("[" + action.getFault().getDetail() + "]"); } } } }
public void doAction(String verb, Action action, Link link, boolean detail) throws Exception { Response r = null; Exception failure = null; try { WebClient post = getClient(link.getHref()); r = post.path("/").post(action); } catch (Exception e) { failure = e; } int expectedStatus = action.isAsync() ? 202 : 200; if (failure != null || r.getStatus() != expectedStatus) { diagnose(verb + " failed with ", failure, r, expectedStatus); } else { Action reaction = unmarshall(r, Action.class); String monitor = Status.COMPLETE.equals(reaction.getStatus()) || Status.FAILED.equals(reaction.getStatus()) ? "" : ", monitor @ " + reaction.getHref(); System.out.println(verb + " " + reaction.getStatus() + monitor); if (Status.FAILED.equals(reaction.getStatus()) && reaction.isSetFault()) { System.out.println("[" + reaction.getFault().getReason() + "]"); if (detail) { System.out.println("[" + reaction.getFault().getDetail() + "]"); } } } }
if (!action.getStatus().getState().equals(CreationStatus.FAILED.value())) { status = Status.OK; } else {