Sha256: 4e3388c6017e6d7fd078308abfade4bddb9bd84dcebbb743a9e689f80f2ddf66

Contents?: true

Size: 790 Bytes

Versions: 32

Compression:

Stored size: 790 Bytes

Contents

# frozen_string_literal: true

module Puppet::Util
  class ExecutionStub
    class << self
      # Set a stub block that Puppet::Util::Execution.execute() should invoke instead
      # of actually executing commands on the target machine.  Intended
      # for spec testing.
      #
      # The arguments passed to the block are |command, options|, where
      # command is an array of strings and options is an options hash.
      def set(&block)
        @value = block
      end

      # Uninstall any execution stub, so that calls to
      # Puppet::Util::Execution.execute() behave normally again.
      def reset
        @value = nil
      end

      # Retrieve the current execution stub, or nil if there is no stub.
      def current_value
        @value
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
puppet-8.10.0 lib/puppet/util/execution_stub.rb
puppet-8.10.0-x86-mingw32 lib/puppet/util/execution_stub.rb
puppet-8.10.0-x64-mingw32 lib/puppet/util/execution_stub.rb
puppet-8.10.0-universal-darwin lib/puppet/util/execution_stub.rb
puppet-8.9.0 lib/puppet/util/execution_stub.rb
puppet-8.9.0-x86-mingw32 lib/puppet/util/execution_stub.rb
puppet-8.9.0-x64-mingw32 lib/puppet/util/execution_stub.rb
puppet-8.9.0-universal-darwin lib/puppet/util/execution_stub.rb
puppet-8.8.1 lib/puppet/util/execution_stub.rb
puppet-8.8.1-x86-mingw32 lib/puppet/util/execution_stub.rb
puppet-8.8.1-x64-mingw32 lib/puppet/util/execution_stub.rb
puppet-8.8.1-universal-darwin lib/puppet/util/execution_stub.rb
puppet-8.7.0 lib/puppet/util/execution_stub.rb
puppet-8.7.0-x86-mingw32 lib/puppet/util/execution_stub.rb
puppet-8.7.0-x64-mingw32 lib/puppet/util/execution_stub.rb
puppet-8.7.0-universal-darwin lib/puppet/util/execution_stub.rb
puppet-8.6.0 lib/puppet/util/execution_stub.rb
puppet-8.6.0-x86-mingw32 lib/puppet/util/execution_stub.rb
puppet-8.6.0-x64-mingw32 lib/puppet/util/execution_stub.rb
puppet-8.6.0-universal-darwin lib/puppet/util/execution_stub.rb