Sha256: 5c40c9c71110e41a37bfa86c48d3f25766751d2b9ce5ed3524c28d4635e6efb0

Contents?: true

Size: 1.07 KB

Versions: 164

Compression:

Stored size: 1.07 KB

Contents

# A command that can be executed on the system
class Puppet::Provider::Command
  attr_reader :executable
  attr_reader :name

  # @param [String] name A way of referencing the name
  # @param [String] executable The path to the executable file
  # @param resolver An object for resolving the executable to an absolute path (usually Puppet::Util)
  # @param executor An object for performing the actual execution of the command (usually Puppet::Util::Execution)
  # @param [Hash] options Extra options to be used when executing (see Puppet::Util::Execution#execute)
  def initialize(name, executable, resolver, executor, options = {})
    @name = name
    @executable = executable
    @resolver = resolver
    @executor = executor
    @options = options
  end

  # @param args [Array<String>] Any command line arguments to pass to the executable
  # @return The output from the command
  def execute(*args)
    resolved_executable = @resolver.which(@executable) or raise Puppet::MissingCommand, "Command #{@name} is missing"
    @executor.execute([resolved_executable] + args, @options)
  end
end

Version data entries

164 entries across 164 versions & 2 rubygems

Version Path
puppet-retrospec-1.8.0 vendor/pup410/lib/puppet/provider/command.rb
puppet-retrospec-1.7.0 vendor/pup410/lib/puppet/provider/command.rb
puppet-4.10.12 lib/puppet/provider/command.rb
puppet-4.10.12-x86-mingw32 lib/puppet/provider/command.rb
puppet-4.10.12-x64-mingw32 lib/puppet/provider/command.rb
puppet-4.10.12-universal-darwin lib/puppet/provider/command.rb
puppet-4.10.11 lib/puppet/provider/command.rb
puppet-4.10.11-x86-mingw32 lib/puppet/provider/command.rb
puppet-4.10.11-x64-mingw32 lib/puppet/provider/command.rb
puppet-4.10.11-universal-darwin lib/puppet/provider/command.rb
puppet-4.10.10 lib/puppet/provider/command.rb
puppet-4.10.10-x86-mingw32 lib/puppet/provider/command.rb
puppet-4.10.10-x64-mingw32 lib/puppet/provider/command.rb
puppet-4.10.10-universal-darwin lib/puppet/provider/command.rb
puppet-retrospec-1.6.1 vendor/pup410/lib/puppet/provider/command.rb
puppet-retrospec-1.6.0 vendor/pup410/lib/puppet/provider/command.rb
puppet-4.10.9 lib/puppet/provider/command.rb
puppet-4.10.9-x86-mingw32 lib/puppet/provider/command.rb
puppet-4.10.9-x64-mingw32 lib/puppet/provider/command.rb
puppet-4.10.9-universal-darwin lib/puppet/provider/command.rb