Class: Puppet::Provider::CommandDefiner Private

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

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Internal helper class when creating commands - undocumented.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, path, confiner) ⇒ CommandDefiner

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of CommandDefiner.



238
239
240
241
242
243
244
# File 'lib/puppet/provider.rb', line 238

def initialize(name, path, confiner)
  @name = name
  @path = path
  @optional = false
  @confiner = confiner
  @custom_environment = {}
end

Class Method Details

.define(name, path, confiner, &block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



232
233
234
235
236
# File 'lib/puppet/provider.rb', line 232

def self.define(name, path, confiner, &block)
  definer = new(name, path, confiner)
  definer.instance_eval(&block) if block
  definer.command
end

Instance Method Details

#commandObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



254
255
256
257
258
259
260
# File 'lib/puppet/provider.rb', line 254

def command
  if not @optional
    @confiner.confine :exists => @path, :for_binary => true
  end

  Puppet::Provider::Command.new(@name, @path, Puppet::Util, Puppet::Util::Execution, { :failonfail => true, :combine => true, :custom_environment => @custom_environment })
end

#environment(env) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



250
251
252
# File 'lib/puppet/provider.rb', line 250

def environment(env)
  @custom_environment = @custom_environment.merge(env)
end

#is_optionalObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



246
247
248
# File 'lib/puppet/provider.rb', line 246

def is_optional
  @optional = true
end