class Puppet::Provider::CommandDefiner
Internal helper class when creating commands - undocumented. @api private
Public Class Methods
define(name, path, confiner, &block)
click to toggle source
# File lib/puppet/provider.rb 218 def self.define(name, path, confiner, &block) 219 definer = new(name, path, confiner) 220 definer.instance_eval(&block) if block 221 definer.command 222 end
new(name, path, confiner)
click to toggle source
# File lib/puppet/provider.rb 224 def initialize(name, path, confiner) 225 @name = name 226 @path = path 227 @optional = false 228 @confiner = confiner 229 @custom_environment = {} 230 end
Private Class Methods
new(closure_scope, loader)
click to toggle source
Calls superclass method
Object::new
# File lib/puppet/functions/match.rb 48 def initialize(closure_scope, loader) 49 super 50 51 # Make this visitor shared among all instantiations of this function since it is faster. 52 # This can be used because it is not possible to replace 53 # a puppet runtime (where this function is) without a reboot. If you model a function in a module after 54 # this class, use a regular instance variable instead to enable reloading of the module without reboot 55 # 56 @@match_visitor ||= Puppet::Pops::Visitor.new(self, "match", 1, 1) 57 end
Public Instance Methods
command()
click to toggle source
# File lib/puppet/provider.rb 240 def command 241 if not @optional 242 @confiner.confine :exists => @path, :for_binary => true 243 end 244 245 Puppet::Provider::Command.new(@name, @path, Puppet::Util, Puppet::Util::Execution, { :failonfail => true, :combine => true, :custom_environment => @custom_environment }) 246 end
environment(env)
click to toggle source
# File lib/puppet/provider.rb 236 def environment(env) 237 @custom_environment = @custom_environment.merge(env) 238 end
is_optional()
click to toggle source
# File lib/puppet/provider.rb 232 def is_optional 233 @optional = true 234 end