class Puppet::Provider::Command
A command that can be executed on the system
Attributes
executable[R]
name[R]
Public Class Methods
new(name, executable, resolver, executor, options = {})
click to toggle source
@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)
# File lib/puppet/provider/command.rb 12 def initialize(name, executable, resolver, executor, options = {}) 13 @name = name 14 @executable = executable 15 @resolver = resolver 16 @executor = executor 17 @options = options 18 end
Public Instance Methods
execute(*args)
click to toggle source
@param args [Array<String>] Any command line arguments to pass to the executable @return The output from the command
# File lib/puppet/provider/command.rb 22 def execute(*args) 23 resolved_executable = @resolver.which(@executable) or raise Puppet::MissingCommand, _("Command %{name} is missing") % { name: @name } 24 @executor.execute([resolved_executable] + args, @options) 25 end