Class: Bolt::PlanResult

Inherits:
Object
  • Object
show all
Defined in:
lib/bolt/plan_result.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, status) ⇒ PlanResult

Returns a new instance of PlanResult.



23
24
25
26
# File 'lib/bolt/plan_result.rb', line 23

def initialize(value, status)
  @value = value
  @status = status
end

Instance Attribute Details

#statusObject

Returns the value of attribute status.



9
10
11
# File 'lib/bolt/plan_result.rb', line 9

def status
  @status
end

#valueObject

Returns the value of attribute value.



9
10
11
# File 'lib/bolt/plan_result.rb', line 9

def value
  @value
end

Class Method Details

.from_pcore(result, status) ⇒ Object

This must be called from inside a compiler



12
13
14
15
16
17
18
19
20
21
# File 'lib/bolt/plan_result.rb', line 12

def self.from_pcore(result, status)
  result = Bolt::Util.walk_vals(result) do |v|
    if v.is_a?(Puppet::DataTypes::Error)
      Bolt::PuppetError.from_error(v)
    else
      v
    end
  end
  new(result, status)
end

Instance Method Details

#==(other) ⇒ Object



32
33
34
# File 'lib/bolt/plan_result.rb', line 32

def ==(other)
  value == other.value && status == other.status
end

#ok?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/bolt/plan_result.rb', line 28

def ok?
  @status == 'success'
end

#to_json(*args) ⇒ Object



36
37
38
# File 'lib/bolt/plan_result.rb', line 36

def to_json(*args)
  @value.to_json(*args)
end

#to_sObject



40
41
42
# File 'lib/bolt/plan_result.rb', line 40

def to_s
  to_json
end