Skip to content

Commit

Permalink
Merge pull request #1970 from HubSpot/deploy-history-bugfix
Browse files Browse the repository at this point in the history
Proxy deploy cancellations to leader
  • Loading branch information
ssalinas authored Jul 10, 2019
2 parents aef13c9 + 528b548 commit 57e8ac2
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,14 @@ public SingularityRequestParent deploy(SingularityDeployRequest deployRequest, S
)
public SingularityRequestParent cancelDeploy(
@Parameter(hidden = true) @Auth SingularityUser user,
@Context HttpServletRequest requestContext,
@Parameter(required = true, description = "The Singularity Request Id from which the deployment is removed.") @PathParam("requestId") String requestId,
@Parameter(required = true, description = "The Singularity Deploy Id that should be removed.") @PathParam("deployId") String deployId) {

return maybeProxyToLeader(requestContext, SingularityRequestParent.class, null, () -> cancelDeploy(user, requestId, deployId));
}

public SingularityRequestParent cancelDeploy(SingularityUser user, String requestId, String deployId) {
SingularityRequestWithState requestWithState = fetchRequestWithState(requestId, user);

authorizationHelper.checkForAuthorization(requestWithState.getRequest(), user, SingularityAuthorizationScope.WRITE);
Expand All @@ -217,7 +223,12 @@ public SingularityRequestParent cancelDeploy(
)
public SingularityRequestParent updatePendingDeploy(
@Parameter(hidden = true) @Auth SingularityUser user,
@Context HttpServletRequest requestContext,
@RequestBody(required = true) SingularityUpdatePendingDeployRequest updateRequest) {
return maybeProxyToLeader(requestContext, SingularityRequestParent.class, updateRequest, () -> updatePendingDeploy(user, updateRequest));
}

public SingularityRequestParent updatePendingDeploy(SingularityUser user, SingularityUpdatePendingDeployRequest updateRequest) {
SingularityRequestWithState requestWithState = fetchRequestWithState(updateRequest.getRequestId(), user);

authorizationHelper.checkForAuthorization(requestWithState.getRequest(), user, SingularityAuthorizationScope.WRITE);
Expand Down

0 comments on commit 57e8ac2

Please # to comment.