Class: Puppet::Provider::CommandDefiner Private
- 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
- #command ⇒ Object private
- #environment(env) ⇒ Object private
-
#initialize(name, path, confiner) ⇒ CommandDefiner
constructor
private
A new instance of CommandDefiner.
-
#is_optional ⇒ Object
private
rubocop:disable Naming/PredicateName.
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.
227 228 229 230 231 232 233 |
# File 'lib/puppet/provider.rb', line 227 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.
221 222 223 224 225 |
# File 'lib/puppet/provider.rb', line 221 def self.define(name, path, confiner, &block) definer = new(name, path, confiner) definer.instance_eval(&block) if block definer.command end |
Instance Method Details
#command ⇒ 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.
243 244 245 246 247 248 249 |
# File 'lib/puppet/provider.rb', line 243 def command unless @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.
239 240 241 |
# File 'lib/puppet/provider.rb', line 239 def environment(env) @custom_environment = @custom_environment.merge(env) end |
#is_optional ⇒ 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.
rubocop:disable Naming/PredicateName
235 236 237 |
# File 'lib/puppet/provider.rb', line 235 def is_optional # rubocop:disable Naming/PredicateName @optional = true end |