Class: Puppet::Provider::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet/provider/command.rb

Overview

A command that can be executed on the system

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, executable, resolver, executor, options = {}) ⇒ Command

Returns a new instance of Command.



11
12
13
14
15
16
17
# File 'lib/puppet/provider/command.rb', line 11

def initialize(name, executable, resolver, executor, options = {})
  @name = name
  @executable = executable
  @resolver = resolver
  @executor = executor
  @options = options
end

Instance Attribute Details

#executableObject (readonly)



3
4
5
# File 'lib/puppet/provider/command.rb', line 3

def executable
  @executable
end

#nameObject (readonly)



4
5
6
# File 'lib/puppet/provider/command.rb', line 4

def name
  @name
end

Instance Method Details

#execute(*args) ⇒ Object

Returns The output from the command.



21
22
23
24
# File 'lib/puppet/provider/command.rb', line 21

def execute(*args)
  resolved_executable = @resolver.which(@executable) or raise Puppet::MissingCommand, "Command #{@name} is missing"
  @executor.execute([resolved_executable] + args, @options)
end