1 class Arvados::V1::NodesController < ApplicationController
2 skip_before_filter :require_auth_scope, :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| ping_arvados_v1_node_url(h) })
13 def self._ping_requires_parameters
19 @object = Node.where(uuid: (params[:id] || params[:uuid])).first
21 return render_not_found
24 ip: params[:local_ipv4] || request.env['REMOTE_ADDR'],
25 ec2_instance_id: params[:instance_id]
27 [:ping_secret, :total_cpu_cores, :total_ram_mb, :total_scratch_mb]
29 ping_data[key] = params[key] if params[key]
31 @object.ping(ping_data)
32 if @object.info['ping_secret'] == params[:ping_secret]
33 render json: @object.as_api_response(:superuser)
35 raise "Invalid ping_secret after ping"
40 def find_objects_for_index
41 if current_user.andand.is_admin || !current_user.andand.is_active
44 # active non-admin users can list nodes that are (or were
46 @objects = model_class.where('last_ping_at >= ?', Time.now - 1.hours)