[ARVADOS] updated: d7c09707b2b5146367c2988b75deffce21b5ae2c

git at public.curoverse.com git at public.curoverse.com
Wed Sep 24 10:16:01 EDT 2014


Summary of changes:
 apps/workbench/app/controllers/projects_controller.rb | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

       via  d7c09707b2b5146367c2988b75deffce21b5ae2c (commit)
      from  06a956718e8dd55a2cdd4a84fcdfb7a3b5a0f635 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit d7c09707b2b5146367c2988b75deffce21b5ae2c
Author: radhika <radhika at curoverse.com>
Date:   Wed Sep 24 10:15:22 2014 -0400

    3836: if there is a unique constraint violation when a collection is removed from a project,
    which happens if there is already a collection with that same name in the Home project,
    rename the collection to ensure the removal process can complete.

diff --git a/apps/workbench/app/controllers/projects_controller.rb b/apps/workbench/app/controllers/projects_controller.rb
index 323f2a1..2cbdcc9 100644
--- a/apps/workbench/app/controllers/projects_controller.rb
+++ b/apps/workbench/app/controllers/projects_controller.rb
@@ -127,8 +127,21 @@ class ProjectsController < ApplicationController
       if item.owner_uuid == @object.uuid
         # Object is owned by this project. Remove it from the project by
         # changing owner to the current user.
-        item.update_attributes owner_uuid: current_user.uuid
-        @removed_uuids << item.uuid
+        begin
+          item.update_attributes owner_uuid: current_user.uuid
+          @removed_uuids << item.uuid
+        rescue ArvadosApiClient::ApiErrorResponseException => e
+          if e.message.include? 'collection_owner_uuid_name_unique'
+            rename_to = item.name + ' removed from ' +
+                        (@object.name ? @object.name : @object.uuid) +
+                        ' at ' + Time.now.to_s
+            updates = {}
+            updates[:name] = rename_to
+            updates[:owner_uuid] = current_user.uuid
+            item.update_attributes updates
+            @removed_uuids << item.uuid
+          end
+        end
       end
     end
   end

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list