Method: Puppet::Util::Autoload.load_file

Defined in:
lib/puppet/util/autoload.rb

.load_file(name, 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.

Load a single plugin by name. We use ‘load’ here so we can reload a given plugin.



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/puppet/util/autoload.rb', line 73

def load_file(name, env)
  file = get_file(name.to_s, env)
  return false unless file
  begin
    mark_loaded(name, file)
    Kernel.load file
    return true
  rescue SystemExit,NoMemoryError
    raise
  rescue Exception => detail
    message = _("Could not autoload %{name}: %{detail}") % { name: name, detail: detail }
    Puppet.log_exception(detail, message)
    raise Puppet::Error, message, detail.backtrace
  end
end