private boolean forceQuitActiveAction(final Long actionId) { if (actionId != null) { try { deploymentManagement.forceQuitAction(actionId); return true; } catch (final CancelActionNotAllowedException e) { LOG.info("Force Cancel action not allowed exception :{}", e); return false; } } return false; }
private boolean forceQuitActiveAction(final Long actionId) { if (actionId != null) { try { deploymentManagement.forceQuitAction(actionId); return true; } catch (final CancelActionNotAllowedException e) { LOG.info("Force Cancel action not allowed exception :{}", e); return false; } } return false; }
@Override public ResponseEntity<Void> cancelAction(@PathVariable("targetId") final String targetId, @PathVariable("actionId") final Long actionId, @RequestParam(value = "force", required = false, defaultValue = "false") final boolean force) { final Action action = deploymentManagement.findAction(actionId) .orElseThrow(() -> new EntityNotFoundException(Action.class, actionId)); if (!action.getTarget().getControllerId().equals(targetId)) { LOG.warn(ACTION_TARGET_MISSING_ASSIGN_WARN, actionId, targetId); return ResponseEntity.notFound().build(); } if (force) { this.deploymentManagement.forceQuitAction(actionId); } else { this.deploymentManagement.cancelAction(actionId); } // both functions will throw an exception, when action is in wrong // state, which is mapped by MgmtResponseExceptionHandler. return ResponseEntity.noContent().build(); }