Class: Puppet::Provider::Command
- Defined in:
- lib/puppet/provider/command.rb
Overview
A command that can be executed on the system
Instance Attribute Summary collapse
- #executable ⇒ Object readonly
- #name ⇒ Object readonly
Instance Method Summary collapse
-
#execute(*args) ⇒ Object
The output from the command.
-
#initialize(name, executable, resolver, executor, options = {}) ⇒ Command
constructor
A new instance of Command.
Constructor Details
#initialize(name, executable, resolver, executor, options = {}) ⇒ Command
Returns a new instance of Command.
13 14 15 16 17 18 19 |
# File 'lib/puppet/provider/command.rb', line 13 def initialize(name, executable, resolver, executor, = {}) @name = name @executable = executable @resolver = resolver @executor = executor @options = end |
Instance Attribute Details
#executable ⇒ Object (readonly)
5 6 7 |
# File 'lib/puppet/provider/command.rb', line 5 def executable @executable end |
Instance Method Details
#execute(*args) ⇒ Object
Returns The output from the command.
23 24 25 26 |
# File 'lib/puppet/provider/command.rb', line 23 def execute(*args) resolved_executable = @resolver.which(@executable) or raise Puppet::MissingCommand, _("Command %{name} is missing") % { name: @name } @executor.execute([resolved_executable] + args, @options) end |