Sha256: f7d66c7a97b7136de144f67bf9e86ba325eff2cc9b342864f2df602d452bf5ee

Contents?: true

Size: 899 Bytes

Versions: 14

Compression:

Stored size: 899 Bytes

Contents

module CORL
module Action
class Exec < Plugin::CloudAction
 
  #----------------------------------------------------------------------------
  # Settings
  
  def configure
    super do
      register :command, :array, nil
    end
  end
  
  #---
  
  def arguments
    [ :command ]
  end
 
  #-----------------------------------------------------------------------------
  # Operations
   
  def execute
    super do |node, network|
      ensure_node(node) do
        if settings[:command].length > 1
          settings[:command].collect! do |value|
            if value.strip.match(/\s+/)
              value = "\"#{value}\""
            end
            value
          end
        end
        
        command_str   = settings[:command].join(' ')
        result        = node.exec({ :commands => [ command_str ] }).first
        myself.status = result.status
      end
    end
  end
end
end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
corl-0.4.29 lib/CORL/action/exec.rb
corl-0.4.28 lib/CORL/action/exec.rb
corl-0.4.27 lib/CORL/action/exec.rb
corl-0.4.26 lib/CORL/action/exec.rb
corl-0.4.25 lib/CORL/action/exec.rb
corl-0.4.24 lib/CORL/action/exec.rb
corl-0.4.23 lib/CORL/action/exec.rb
corl-0.4.22 lib/CORL/action/exec.rb
corl-0.4.21 lib/CORL/action/exec.rb
corl-0.4.20 lib/CORL/action/exec.rb
corl-0.4.19 lib/CORL/action/exec.rb
corl-0.4.18 lib/CORL/action/exec.rb
corl-0.4.17 lib/CORL/action/exec.rb
corl-0.4.16 lib/CORL/action/exec.rb