1 class Arvados::V1::NodesController < ApplicationController
2 skip_before_filter :require_auth_scope_all, :only => :ping
3 skip_before_filter :find_object_by_uuid, :only => :ping
4 skip_before_filter :render_404_if_no_object, :only => :ping
9 @object.start!(lambda { |h| arvados_v1_ping_node_url(h) })
13 def self._ping_requires_parameters
17 @object = Node.where(uuid: (params[:id] || params[:uuid])).first
19 return render_not_found
21 @object.ping({ ip: params[:local_ipv4] || request.env['REMOTE_ADDR'],
22 ping_secret: params[:ping_secret],
23 ec2_instance_id: params[:instance_id] })
24 if @object.info[:ping_secret] == params[:ping_secret]
25 render json: @object.as_api_response(:superuser)
27 raise "Invalid ping_secret after ping"
31 def find_objects_for_index
32 if current_user.andand.is_admin || !current_user.andand.is_active
35 # active non-admin users can list nodes that are (or were
37 @objects = model_class.where('last_ping_at >= ?', Time.now - 1.hours)