Sha256: 09052a5d6064d8688620b8ab932a9997f9e87ef725a771f4236e2f100192b37e

Contents?: true

Size: 1.6 KB

Versions: 10

Compression:

Stored size: 1.6 KB

Contents

module Nucleon
module Action
module Cloud
class Images < Nucleon.plugin_class(:nucleon, :cloud_action)
  
  #-----------------------------------------------------------------------------
  # Info
  
  def self.describe
    super(:cloud, :images, 850)
  end

  #-----------------------------------------------------------------------------
  # Settings
  
  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
  
  def node_config
    super
    config[:node_provider].default = nil
  end
  
  #---
  
  def ignore
    node_ignore - [ :node_provider ]
  end
  
  def arguments
    [ :node_provider, :search ]
  end
  
  #-----------------------------------------------------------------------------
  # Operations
 
  def execute
    super do |local_node|
      ensure_network do
        if node = network.test_node(settings[:node_provider], { :region => settings[:region] })
          if images = node.images(settings[:search], settings)
            images.each do |image|
              prefixed_message(:info, '  ', node.render_image(image), { :i18n => false, :prefix => false })
            end
          
            myself.result = images
            success('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
end
end
end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
corl-0.5.11 lib/nucleon/action/cloud/images.rb
corl-0.5.10 lib/nucleon/action/cloud/images.rb
corl-0.5.9 lib/nucleon/action/cloud/images.rb
corl-0.5.8 lib/nucleon/action/cloud/images.rb
corl-0.5.7 lib/nucleon/action/cloud/images.rb
corl-0.5.6 lib/nucleon/action/cloud/images.rb
corl-0.5.5 lib/nucleon/action/cloud/images.rb
corl-0.5.4 lib/nucleon/action/cloud/images.rb
corl-0.5.3 lib/nucleon/action/cloud/images.rb
corl-0.5.2 lib/nucleon/action/cloud/images.rb