[ARVADOS] updated: 533a50bbcee4ece451a65e87066563a5b33ef150

Git user git at public.curoverse.com
Tue Mar 7 15:40:02 EST 2017


Summary of changes:
 .../arvados/v1/keep_disks_controller.rb            | 32 ++++++++++------------
 1 file changed, 14 insertions(+), 18 deletions(-)

       via  533a50bbcee4ece451a65e87066563a5b33ef150 (commit)
       via  c97408a51dab3e968c76cf8c1d873fbe0f99a0dd (commit)
      from  4812b5639cfaf724540786fcd331aaa227635c77 (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 533a50bbcee4ece451a65e87066563a5b33ef150
Merge: 4812b56 c97408a
Author: Tom Clegg <tom at curoverse.com>
Date:   Tue Mar 7 15:39:36 2017 -0500

    Merge branch '3115-keep-disk-create-surprise'
    
    closes #3115


commit c97408a51dab3e968c76cf8c1d873fbe0f99a0dd
Author: Tom Clegg <tom at curoverse.com>
Date:   Tue Mar 7 15:32:59 2017 -0500

    3115: Create keep_disks implicitly only in #ping action, not #show.

diff --git a/services/api/app/controllers/arvados/v1/keep_disks_controller.rb b/services/api/app/controllers/arvados/v1/keep_disks_controller.rb
index 2db2a60..f531977 100644
--- a/services/api/app/controllers/arvados/v1/keep_disks_controller.rb
+++ b/services/api/app/controllers/arvados/v1/keep_disks_controller.rb
@@ -1,5 +1,6 @@
 class Arvados::V1::KeepDisksController < ApplicationController
-  skip_before_filter :require_auth_scope, :only => :ping
+  skip_before_filter :require_auth_scope, only: :ping
+  skip_before_filter :render_404_if_no_object, only: :ping
 
   def self._ping_requires_parameters
     {
@@ -15,8 +16,19 @@ class Arvados::V1::KeepDisksController < ApplicationController
 
   def ping
     params[:service_host] ||= request.env['REMOTE_ADDR']
+    if !params[:uuid] && current_user.andand.is_admin
+      # Create a new KeepDisk and ping it.
+      @object = KeepDisk.new(filesystem_uuid: params[:filesystem_uuid])
+      @object.save!
+
+      # In the first ping from this new filesystem_uuid, we can't
+      # expect the keep node to know the ping_secret so we made sure
+      # we got an admin token. Here we add ping_secret to params so
+      # the ping call below is properly authenticated.
+      params[:ping_secret] = @object.ping_secret
+    end
     act_as_system_user do
-      if not @object.ping params
+      if !@object.andand.ping(params)
         return render_not_found "object not found"
       end
       # Render the :superuser view (i.e., include the ping_secret) even
@@ -31,20 +43,4 @@ class Arvados::V1::KeepDisksController < ApplicationController
     @objects = model_class.where('1=1')
     super
   end
-
-  def find_object_by_uuid
-    @object = KeepDisk.where(uuid: (params[:id] || params[:uuid])).first
-    if !@object && current_user.andand.is_admin
-      # Create a new KeepDisk and ping it.
-      @object = KeepDisk.new(filesystem_uuid: params[:filesystem_uuid])
-      @object.save!
-
-      # In the first ping from this new filesystem_uuid, we can't
-      # expect the keep node to know the ping_secret so we made sure
-      # we got an admin token. Here we add ping_secret to params so
-      # KeepNode.ping() understands this update is properly
-      # authenticated.
-      params[:ping_secret] = @object.ping_secret
-    end
-  end
 end

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list