Skip to content
This repository was archived by the owner on Jun 2, 2021. It is now read-only.

Commit 128916a

Browse files
committed
Inline valid_state? method in DeploymentCancel
- In response to PR feedback [cloudfoundry#1513] Authored-by: Greg Cobb <gcobb@pivotal.io>
1 parent 9c9c5d3 commit 128916a

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

app/actions/deployment_cancel.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class << self
1111
def cancel(deployment:, user_audit_info:)
1212
deployment.db.transaction do
1313
deployment.lock!
14-
reject_invalid_state!(deployment) unless valid_state?(deployment)
14+
reject_invalid_state!(deployment) unless deployment.cancelable?
1515

1616
begin
1717
AppAssignDroplet.new(user_audit_info).assign(deployment.app, deployment.previous_droplet)
@@ -29,10 +29,6 @@ def cancel(deployment:, user_audit_info:)
2929

3030
private
3131

32-
def valid_state?(deployment)
33-
deployment.cancelable?
34-
end
35-
3632
def reject_invalid_state!(deployment)
3733
raise InvalidStatus.new("Cannot cancel a deployment with status: #{deployment.status_value} and reason: #{deployment.status_reason}")
3834
end

0 commit comments

Comments
 (0)