Class: Puppet_X::Coi::Jboss::Internal::ExecutionStateWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet_x/coi/jboss/internal/execution_state_wrapper.rb

Overview

System executor responsible of executing provided commands

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(shell_executor) ⇒ ExecutionStateWrapper

Standard constructor



6
7
8
# File 'lib/puppet_x/coi/jboss/internal/execution_state_wrapper.rb', line 6

def initialize(shell_executor)
  @shell_executor = shell_executor
end

Instance Attribute Details

#shell_executorObject

Standard setter for shell_executor



11
12
13
# File 'lib/puppet_x/coi/jboss/internal/execution_state_wrapper.rb', line 11

def shell_executor
  @shell_executor
end

Instance Method Details

#execute(cmd, jbosscmd, environment) ⇒ Puppet_X::Coi::Jboss::Internal::ExecutionState

Method that handles delegation to system executor information about result of execution

Parameters:

  • cmd (String)

    cmd to be executed

  • jbosscmd (String)

    to be executed

  • environment (Hash)

    hash that hold informations about configuration

Returns:

  • (Puppet_X::Coi::Jboss::Internal::ExecutionState)

    execution state that hold



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/puppet_x/coi/jboss/internal/execution_state_wrapper.rb', line 19

def execute(cmd, jbosscmd, environment)
  lines = exec_command(cmd, environment)
  result = last_execute_result

  code = result.exitstatus
  success = result.success?

  Puppet.debug 'execution state begins'

  exececution_state(jbosscmd, code, success, lines)
end

#last_execute_resultProcess::Status

Method that returns status of last command executed

Returns:

  • (Process::Status)

    result of last command



33
34
35
# File 'lib/puppet_x/coi/jboss/internal/execution_state_wrapper.rb', line 33

def last_execute_result
  @result
end