overrite stack name for update (#5743)

pull/5884/head
Marcelo Rydel 2021-10-12 18:48:28 -03:00 committed by GitHub
parent 109b27594a
commit 1ee363f8c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -143,12 +143,14 @@ func (handler *Handler) stackMigrate(w http.ResponseWriter, r *http.Request) *ht
return migrationError return migrationError
} }
newName := stack.Name
stack.Name = oldName stack.Name = oldName
err = handler.deleteStack(securityContext.UserID, stack, endpoint) err = handler.deleteStack(securityContext.UserID, stack, endpoint)
if err != nil { if err != nil {
return &httperror.HandlerError{StatusCode: http.StatusInternalServerError, Message: err.Error(), Err: err} return &httperror.HandlerError{StatusCode: http.StatusInternalServerError, Message: err.Error(), Err: err}
} }
stack.Name = newName
err = handler.DataStore.Stack().UpdateStack(stack.ID, stack) err = handler.DataStore.Stack().UpdateStack(stack.ID, stack)
if err != nil { if err != nil {
return &httperror.HandlerError{StatusCode: http.StatusInternalServerError, Message: "Unable to persist the stack changes inside the database", Err: err} return &httperror.HandlerError{StatusCode: http.StatusInternalServerError, Message: "Unable to persist the stack changes inside the database", Err: err}