class CORL::Action::Images

Public Instance Methods

arguments() click to toggle source
# File lib/CORL/action/images.rb, line 27
def arguments
  [ :node_provider, :search ]
end
configure() click to toggle source
# File lib/CORL/action/images.rb, line 9
def configure
  super do
    codes :node_load_failure,
          :image_load_failure
    
    register :region, :str, nil      
    register :match_case, :bool, false
    register :require_all, :bool, true
    register :search, :array, []
  end
end
execute() click to toggle source
# File lib/CORL/action/images.rb, line 34
def execute
  super do |local_node, network|
    info('corl.actions.images.start')
    
    ensure_network(network) do
      if node = network.test_node(settings[:node_provider], { :region => settings[:region] })
        if images = node.images(settings[:search], settings)
          images.each do |image|
            render(node.render_image(image), { :prefix => false })
          end
        
          myself.result = images
          success('corl.actions.images.results', { :images => images.length }) if images.length > 1
        else
          myself.status = code.image_load_failure
        end
      else
        myself.status = code.node_load_failure
      end
    end
  end
end
ignore() click to toggle source
# File lib/CORL/action/images.rb, line 23
def ignore
  node_ignore - [ :node_provider ]
end