X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/da0d61f9a95848d47d28462d89e0a2070c39d587..bff57ea5cd61b02b829d831e3637151b1cf4b94c:/services/api/app/controllers/arvados/v1/nodes_controller.rb diff --git a/services/api/app/controllers/arvados/v1/nodes_controller.rb b/services/api/app/controllers/arvados/v1/nodes_controller.rb index c9ac096fb5..efee982e74 100644 --- a/services/api/app/controllers/arvados/v1/nodes_controller.rb +++ b/services/api/app/controllers/arvados/v1/nodes_controller.rb @@ -3,13 +3,6 @@ class Arvados::V1::NodesController < ApplicationController skip_before_filter :find_object_by_uuid, :only => :ping skip_before_filter :render_404_if_no_object, :only => :ping - def create - @object = Node.new - @object.save! - @object.start!(lambda { |h| ping_arvados_v1_node_url(h) }) - show - end - def update if resource_attrs[:job_uuid] @object.job_readable = readable_job_uuids(resource_attrs[:job_uuid]).any? @@ -18,7 +11,7 @@ class Arvados::V1::NodesController < ApplicationController end def self._ping_requires_parameters - { ping_secret: true } + { ping_secret: {required: true} } end def ping @@ -45,17 +38,16 @@ class Arvados::V1::NodesController < ApplicationController end def find_objects_for_index - if current_user.andand.is_admin || !current_user.andand.is_active - super - else + if !current_user.andand.is_admin && current_user.andand.is_active # active non-admin users can list nodes that are (or were # recently) working @objects = model_class.where('last_ping_at >= ?', Time.now - 1.hours) end - assigned_nodes = @objects.select(&:job_uuid) - assoc_jobs = readable_job_uuids(*assigned_nodes.map(&:job_uuid)) - assigned_nodes.each do |node| - node.job_readable = assoc_jobs.include?(node.job_uuid) + super + job_uuids = @objects.map { |n| n[:job_uuid] }.compact + assoc_jobs = readable_job_uuids(job_uuids) + @objects.each do |node| + node.job_readable = assoc_jobs.include?(node[:job_uuid]) end end