Sha256: 7573bce6b3f20ca6f69fa2665efb3ab70c2b4f40e5cf4f1584dba3efb9614e8a

Contents?: true

Size: 1.05 KB

Versions: 14

Compression:

Stored size: 1.05 KB

Contents

module Nucleon
module Action
module Node
class Exec < Nucleon.plugin_class(:nucleon, :cloud_action)

  #-----------------------------------------------------------------------------
  # Info

  def self.describe
    super(:node, :exec, 605)
  end

  #----------------------------------------------------------------------------
  # Settings

  def configure
    super do
      register :command, :array, nil
    end
  end

  #---

  def arguments
    [ :command ]
  end

  #-----------------------------------------------------------------------------
  # Operations

  def execute
    super do |node|
      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(' ')

      if node
        result = node.exec({ :commands => [ command_str ] }).first
      else
        result = CORL.cli_run(command_str)
      end
      myself.status = result.status
    end
  end
end
end
end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
corl-0.5.18 lib/nucleon/action/node/exec.rb
corl-0.5.17 lib/nucleon/action/node/exec.rb
corl-0.5.16 lib/nucleon/action/node/exec.rb
corl-0.5.15 lib/nucleon/action/node/exec.rb
corl-0.5.14 lib/nucleon/action/node/exec.rb
corl-0.5.13 lib/nucleon/action/node/exec.rb
corl-0.5.12 lib/nucleon/action/node/exec.rb
corl-0.5.11 lib/nucleon/action/node/exec.rb
corl-0.5.10 lib/nucleon/action/node/exec.rb
corl-0.5.9 lib/nucleon/action/node/exec.rb
corl-0.5.8 lib/nucleon/action/node/exec.rb
corl-0.5.7 lib/nucleon/action/node/exec.rb
corl-0.5.6 lib/nucleon/action/node/exec.rb
corl-0.5.5 lib/nucleon/action/node/exec.rb