weldr: Allow cancel on waiting and running composes
Fix the cancel API to allow a waiting compose to be canceled. This also fixes the cancel return code to be 400, the lorax-composer behavior was a bug, and using 400 allows composer-cli to properly display the error.
This commit is contained in:
parent
c877f14379
commit
c657713181
1 changed files with 3 additions and 3 deletions
|
|
@ -2496,12 +2496,12 @@ func (api *API) composeCancelHandler(writer http.ResponseWriter, request *http.R
|
||||||
}
|
}
|
||||||
|
|
||||||
composeStatus := api.getComposeStatus(compose)
|
composeStatus := api.getComposeStatus(compose)
|
||||||
if composeStatus.State == ComposeWaiting {
|
if composeStatus.State != ComposeWaiting && composeStatus.State != ComposeRunning {
|
||||||
errors := responseError{
|
errors := responseError{
|
||||||
ID: "BuildInWrongState",
|
ID: "BuildInWrongState",
|
||||||
Msg: fmt.Sprintf("Build %s has not started yet. No logs to view.", uuidString),
|
Msg: fmt.Sprintf("Build %s is not in WAITING or RUNNING.", uuidString),
|
||||||
}
|
}
|
||||||
statusResponseError(writer, http.StatusOK, errors) // weirdly, Lorax returns 200 in this case
|
statusResponseError(writer, http.StatusBadRequest, errors)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue