Sha256: 1b533ee443f76533b1f00d4039ed269115e7a487120acad15bbf6d27d276c8c7

Contents?: true

Size: 747 Bytes

Versions: 24

Compression:

Stored size: 747 Bytes

Contents

# frozen_string_literal: true

require 'json'
require 'bolt/error'
require 'bolt/util'

module Bolt
  class PlanResult
    attr_accessor :value, :status

    # This must be called from inside a compiler
    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

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

    def ok?
      @status == 'success'
    end

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

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

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
bolt-1.3.0 lib/bolt/plan_result.rb
bolt-1.2.0 lib/bolt/plan_result.rb
bolt-1.1.0 lib/bolt/plan_result.rb
bolt-1.0.0 lib/bolt/plan_result.rb
bolt-0.25.0 lib/bolt/plan_result.rb
bolt-0.24.0 lib/bolt/plan_result.rb
bolt-0.23.0 lib/bolt/plan_result.rb
bolt-0.22.0 lib/bolt/plan_result.rb
bolt-0.21.8 lib/bolt/plan_result.rb
bolt-0.21.7 lib/bolt/plan_result.rb
bolt-0.21.6 lib/bolt/plan_result.rb
bolt-0.21.5 lib/bolt/plan_result.rb
bolt-0.21.4 lib/bolt/plan_result.rb
bolt-0.21.3 lib/bolt/plan_result.rb
bolt-0.21.2 lib/bolt/plan_result.rb
bolt-0.21.1 lib/bolt/plan_result.rb
bolt-0.21.0 lib/bolt/plan_result.rb
bolt-0.20.7 lib/bolt/plan_result.rb
bolt-0.20.6 lib/bolt/plan_result.rb
bolt-0.20.5 lib/bolt/plan_result.rb