From c6e201cdd4ca5ee11a04cac77bf32faf40640b6d Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Fri, 24 Aug 2007 18:31:00 -0500 Subject: I have added basic support for a search path, altho not yet with any ability to manipulate it. All config tests pass in both the old tests and the new ones, so it is time to add the hooks for manipulating the search path. --- lib/puppet/util/autoload.rb | 2 -- 1 file changed, 2 deletions(-) (limited to 'lib/puppet/util/autoload.rb') diff --git a/lib/puppet/util/autoload.rb b/lib/puppet/util/autoload.rb index be9e14671..65cd3affb 100644 --- a/lib/puppet/util/autoload.rb +++ b/lib/puppet/util/autoload.rb @@ -150,5 +150,3 @@ class Puppet::Util::Autoload [module_lib_dirs, Puppet[:libdir], $:].flatten end end - -# $Id$ -- cgit From 6700adcacdec4381ee4a27a215ee4b45207aa448 Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Fri, 7 Sep 2007 15:38:24 -0500 Subject: *Finally* fixing the tests that were failing around users and groups. The problem was that the autoload tests were somehow clearing all loaded classes, including the providers. This is fixed now. --- lib/puppet/util/autoload.rb | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'lib/puppet/util/autoload.rb') diff --git a/lib/puppet/util/autoload.rb b/lib/puppet/util/autoload.rb index 65cd3affb..280961837 100644 --- a/lib/puppet/util/autoload.rb +++ b/lib/puppet/util/autoload.rb @@ -3,7 +3,7 @@ class Puppet::Util::Autoload include Puppet::Util @autoloaders = {} - @loaded = {} + @loaded = [] class << self attr_reader :autoloaders @@ -13,12 +13,6 @@ class Puppet::Util::Autoload # Send [], []=, and :clear to the @autloaders hash Puppet::Util.classproxy self, :autoloaders, "[]", "[]=" - # Clear the list of autoloaders and loaded files. - def self.clear - @autoloaders.clear - @loaded.clear - end - # List all loaded files. def self.list_loaded @loaded.sort { |a,b| a[0] <=> b[0] }.collect do |path, hash| @@ -27,15 +21,20 @@ class Puppet::Util::Autoload end # Has a given path been loaded? This is used for testing whether a - # changed file should be loaded or just ignored. + # changed file should be loaded or just ignored. This is only + # used in network/client/master, when downloading plugins, to + # see if a given plugin is currently loaded and thus should be + # reloaded. def self.loaded?(path) path = path.to_s.sub(/\.rb$/, '') - @loaded[path] + @loaded.include?(path) end - # Save the fact that a given path has been loaded - def self.loaded(path, file, loader) - @loaded[path] = {:file => file, :autoloader => loader} + # Save the fact that a given path has been loaded. This is so + # we can load downloaded plugins if they've already been loaded + # into memory. + def self.loaded(file) + @loaded << file unless @loaded.include?(file) end attr_accessor :object, :path, :objwarn, :wrap @@ -94,7 +93,7 @@ class Puppet::Util::Autoload # Mark the named object as loaded. Note that this supports unqualified # queries, while we store the result as a qualified query in the class. def loaded(name, file) - self.class.loaded(File.join(@path, name.to_s), file, object) + self.class.loaded(File.join(@path, name.to_s)) end # Indicate whether the specfied plugin has been loaded. -- cgit