Sha256: c7ac01abf72f8ce6af1500fb3246a10705abd56ca643301d1b329cfb1b55f749

Contents?: true

Size: 1.06 KB

Versions: 82

Compression:

Stored size: 1.06 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::Error, "Command #{@name} is missing"
    @executor.execute([resolved_executable] + args, @options)
  end
end

Version data entries

82 entries across 82 versions & 2 rubygems

Version Path
puppet-retrospec-0.12.2 vendor/gems/puppet-3.7.3/lib/puppet/provider/command.rb
puppet-3.8.7 lib/puppet/provider/command.rb
puppet-3.8.7-x86-mingw32 lib/puppet/provider/command.rb
puppet-3.8.7-x64-mingw32 lib/puppet/provider/command.rb
puppet-3.8.6 lib/puppet/provider/command.rb
puppet-3.8.6-x86-mingw32 lib/puppet/provider/command.rb
puppet-retrospec-0.12.1 vendor/gems/puppet-3.7.3/lib/puppet/provider/command.rb
puppet-3.8.6-x64-mingw32 lib/puppet/provider/command.rb
puppet-retrospec-0.12.0 vendor/gems/puppet-3.7.3/lib/puppet/provider/command.rb
puppet-3.8.5 lib/puppet/provider/command.rb
puppet-3.8.5-x86-mingw32 lib/puppet/provider/command.rb
puppet-3.8.5-x64-mingw32 lib/puppet/provider/command.rb
puppet-3.8.4 lib/puppet/provider/command.rb
puppet-3.8.4-x86-mingw32 lib/puppet/provider/command.rb
puppet-3.8.4-x64-mingw32 lib/puppet/provider/command.rb
puppet-retrospec-0.11.0 vendor/gems/puppet-3.7.3/lib/puppet/provider/command.rb
puppet-retrospec-0.10.0 vendor/gems/puppet-3.7.3/lib/puppet/provider/command.rb
puppet-retrospec-0.9.1 vendor/gems/puppet-3.7.3/lib/puppet/provider/command.rb
puppet-retrospec-0.9.0 vendor/gems/puppet-3.7.3/lib/puppet/provider/command.rb
puppet-retrospec-0.8.1 vendor/gems/puppet-3.7.3/lib/puppet/provider/command.rb