Sha256: f85b050a110f9048cbd387bfbee29c5f99143e2173bb3b40ec803aa65ff97ebd

Contents?: true

Size: 1.06 KB

Versions: 25

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 [Array<String>] Any command line arguments to pass to the executable
  # @returns 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

25 entries across 25 versions & 2 rubygems

Version Path
puppet-3.2.4 lib/puppet/provider/command.rb
puppet-3.2.3 lib/puppet/provider/command.rb
puppet-3.2.3.rc1 lib/puppet/provider/command.rb
puppet-3.2.2 lib/puppet/provider/command.rb
puppet-3.2.1 lib/puppet/provider/command.rb
puppet-3.2.1.rc1 lib/puppet/provider/command.rb
puppet-3.2.0.rc2 lib/puppet/provider/command.rb
librarian-puppet-0.9.9 vendor/gems/ruby/1.9.1/gems/puppet-3.1.0/lib/puppet/provider/command.rb
puppet-3.2.0.rc1 lib/puppet/provider/command.rb
puppet-3.1.1 lib/puppet/provider/command.rb
librarian-puppet-0.9.8 vendor/gems/ruby/1.9.1/gems/puppet-3.1.0/lib/puppet/provider/command.rb
puppet-3.1.0 lib/puppet/provider/command.rb
puppet-3.1.0.rc2 lib/puppet/provider/command.rb
puppet-3.1.0.rc1 lib/puppet/provider/command.rb
puppet-3.0.2 lib/puppet/provider/command.rb
puppet-3.0.2.rc3 lib/puppet/provider/command.rb
puppet-3.0.2.rc2 lib/puppet/provider/command.rb
puppet-3.0.2.rc1 lib/puppet/provider/command.rb
puppet-3.0.1 lib/puppet/provider/command.rb
puppet-3.0.1.rc1 lib/puppet/provider/command.rb