1 class Arvados::V1::KeepDisksController < ApplicationController
2 skip_before_filter :require_auth_scope, :only => :ping
4 def self._ping_requires_parameters
9 filesystem_uuid: false,
12 service_ssl_flag: true
17 params[:service_host] ||= request.env['REMOTE_ADDR']
19 if not @object.ping params
20 return render_not_found "object not found"
22 # Render the :superuser view (i.e., include the ping_secret) even
23 # if !current_user.is_admin. This is safe because @object.ping's
24 # success implies the ping_secret was already known by the client.
25 render json: @object.as_api_response(:superuser)
29 def find_objects_for_index
30 # all users can list all keep disks
31 @objects = model_class.where('1=1')
35 def find_object_by_uuid
36 @object = KeepDisk.where(uuid: (params[:id] || params[:uuid])).first
37 if !@object && current_user.andand.is_admin
38 # Create a new KeepDisk and ping it.
39 @object = KeepDisk.new(filesystem_uuid: params[:filesystem_uuid])
42 # In the first ping from this new filesystem_uuid, we can't
43 # expect the keep node to know the ping_secret so we made sure
44 # we got an admin token. Here we add ping_secret to params so
45 # KeepNode.ping() understands this update is properly
47 params[:ping_secret] = @object.ping_secret