cloudapi: Add artifact cleanup to delete handler
Related: RHEL-60120
This commit is contained in:
parent
56fc58cca3
commit
b33f86783f
2 changed files with 7 additions and 0 deletions
|
|
@ -79,6 +79,7 @@ const (
|
||||||
ErrorGettingComposeList ServiceErrorCode = 1021
|
ErrorGettingComposeList ServiceErrorCode = 1021
|
||||||
ErrorArtifactNotFound ServiceErrorCode = 1022
|
ErrorArtifactNotFound ServiceErrorCode = 1022
|
||||||
ErrorDeletingJob ServiceErrorCode = 1023
|
ErrorDeletingJob ServiceErrorCode = 1023
|
||||||
|
ErrorDeletingArtifacts ServiceErrorCode = 1024
|
||||||
|
|
||||||
// Errors contained within this file
|
// Errors contained within this file
|
||||||
ErrorUnspecified ServiceErrorCode = 10000
|
ErrorUnspecified ServiceErrorCode = 10000
|
||||||
|
|
@ -165,6 +166,7 @@ func getServiceErrors() serviceErrors {
|
||||||
serviceError{ErrorTenantNotInContext, http.StatusInternalServerError, "Unable to retrieve tenant from request context"},
|
serviceError{ErrorTenantNotInContext, http.StatusInternalServerError, "Unable to retrieve tenant from request context"},
|
||||||
serviceError{ErrorGettingComposeList, http.StatusInternalServerError, "Unable to get list of composes"},
|
serviceError{ErrorGettingComposeList, http.StatusInternalServerError, "Unable to get list of composes"},
|
||||||
serviceError{ErrorDeletingJob, http.StatusInternalServerError, "Unable to delete job"},
|
serviceError{ErrorDeletingJob, http.StatusInternalServerError, "Unable to delete job"},
|
||||||
|
serviceError{ErrorDeletingArtifacts, http.StatusInternalServerError, "Unable to delete job artifacts"},
|
||||||
|
|
||||||
serviceError{ErrorUnspecified, http.StatusInternalServerError, "Unspecified internal error "},
|
serviceError{ErrorUnspecified, http.StatusInternalServerError, "Unspecified internal error "},
|
||||||
serviceError{ErrorNotHTTPError, http.StatusInternalServerError, "Error is not an instance of HTTPError"},
|
serviceError{ErrorNotHTTPError, http.StatusInternalServerError, "Error is not an instance of HTTPError"},
|
||||||
|
|
|
||||||
|
|
@ -345,6 +345,11 @@ func (h *apiHandlers) deleteComposeImpl(ctx echo.Context, jobId uuid.UUID) error
|
||||||
return HTTPErrorWithInternal(ErrorDeletingJob, err)
|
return HTTPErrorWithInternal(ErrorDeletingJob, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = h.server.workers.CleanupArtifacts()
|
||||||
|
if err != nil {
|
||||||
|
return HTTPErrorWithInternal(ErrorDeletingArtifacts, err)
|
||||||
|
}
|
||||||
|
|
||||||
return ctx.JSON(http.StatusOK, ComposeDeleteStatus{
|
return ctx.JSON(http.StatusOK, ComposeDeleteStatus{
|
||||||
Href: fmt.Sprintf("/api/image-builder-composer/v2/composes/delete/%v", jobId),
|
Href: fmt.Sprintf("/api/image-builder-composer/v2/composes/delete/%v", jobId),
|
||||||
Id: jobId.String(),
|
Id: jobId.String(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue