fix(stack) Unable to update and redeploy a stack created from a git repository if it has failed once EE-1012 (#5212)

testing passed
pull/5222/head
cong meng 3 years ago committed by GitHub
parent 89f53458c6
commit 8e3751d0b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -116,6 +116,13 @@ func (handler *Handler) stackUpdateGit(w http.ResponseWriter, r *http.Request) *
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to clone git repository", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to clone git repository", err}
} }
defer func() {
err = handler.FileService.RemoveDirectory(backupProjectPath)
if err != nil {
log.Printf("[WARN] [http,stacks,git] [error: %s] [message: unable to remove git repository directory]", err)
}
}()
httpErr := handler.deployStack(r, stack, endpoint) httpErr := handler.deployStack(r, stack, endpoint)
if httpErr != nil { if httpErr != nil {
return httpErr return httpErr
@ -126,11 +133,6 @@ func (handler *Handler) stackUpdateGit(w http.ResponseWriter, r *http.Request) *
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist the stack changes inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist the stack changes inside the database", err}
} }
err = handler.FileService.RemoveDirectory(backupProjectPath)
if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to remove git repository directory", err}
}
return response.JSON(w, stack) return response.JSON(w, stack)
} }

Loading…
Cancel
Save