private boolean cancelActiveAction(final Long actionId) { if (actionId != null) { try { deploymentManagement.cancelAction(actionId); return true; } catch (final CancelActionNotAllowedException e) { LOG.info("Cancel action not allowed exception :{}", e); return false; } } return false; }
private boolean cancelActiveAction(final Long actionId) { if (actionId != null) { try { deploymentManagement.cancelAction(actionId); return true; } catch (final CancelActionNotAllowedException e) { LOG.info("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(); }
.assignDistributionSet(set.getId(), Arrays.asList(target.getTargetWithActionType())).getActions() .get(0); final Action cancelAction = deploymentManagement.cancelAction(actionId);
.assignDistributionSet(set.getId(), Arrays.asList(target.getTargetWithActionType())).getActions() .get(0); final Action cancelAction = deploymentManagement.cancelAction(actionId);