diff options
author | Robert Speicher <robert@gitlab.com> | 2018-03-19 15:22:06 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2018-03-19 15:22:06 +0000 |
commit | 27e9b8bf3a4af67dbca2caddc7f5f2674653e43c (patch) | |
tree | dd82d48482d810829ce970af01301c53004b6fb1 /app/services | |
parent | c2fedd73358b31697c3393a607a960ebf60af961 (diff) | |
parent | ca63603d052808b7a5ab9b04acc611215e23a8c3 (diff) | |
download | gitlab-ce-27e9b8bf3a4af67dbca2caddc7f5f2674653e43c.tar.gz |
Merge branch 'sh-fix-failure-project-destroy' into 'master'
Fix "Can't modify frozen hash" error when project is destroyed
See merge request gitlab-org/gitlab-ce!17816
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/projects/destroy_service.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/services/projects/destroy_service.rb b/app/services/projects/destroy_service.rb index 81972df9b3c..4b8f955ae69 100644 --- a/app/services/projects/destroy_service.rb +++ b/app/services/projects/destroy_service.rb @@ -88,7 +88,11 @@ module Projects def attempt_rollback(project, message) return unless project - project.update_attributes(delete_error: message, pending_delete: false) + # It's possible that the project was destroyed, but some after_commit + # hook failed and caused us to end up here. A destroyed model will be a frozen hash, + # which cannot be altered. + project.update_attributes(delete_error: message, pending_delete: false) unless project.destroyed? + log_error("Deletion failed on #{project.full_path} with the following message: #{message}") end |