Sha256: 065b0ea53afd1adbe6ad1c5e003918ab5aed18e9a62fc29cae1271d56bc96f98

Contents?: true

Size: 985 Bytes

Versions: 1

Compression:

Stored size: 985 Bytes

Contents

module CORL
module Action
class Lookup < Plugin::CloudAction
 
  #-----------------------------------------------------------------------------
  # Settings
  
  def configure
    super do
      register :property, :str, nil
      register :context, :str, :priority do |value|
        success = true
        options = [ :priority, :array, :hash ]
        unless options.include?(value.to_sym)
          warn('corl.actions.lookup.errors.context', { :value => value, :options => options.join(', ') })
          success = false
        end
        success
      end
    end
  end
  
  #---
  
  def arguments
    [ :property ]
  end

  #-----------------------------------------------------------------------------
  # Operations
   
  def execute
    super do |node, network|
      ensure_node(node) do
        property = settings[:property]
        value    = node.lookup(property)
      
        ui.info(sprintf("#{property} = %s", value.inspect))
      end
    end
  end
end
end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
corl-0.4.22 lib/CORL/action/lookup.rb