From e408d6c7d562f126df97cd57e04fd7802bc53390 Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Tue, 18 Aug 2009 16:00:21 -0700 Subject: Refactoring the Module/Environment co-interface This simplifies who owns what code in these two classes, and the result should be much cleaner and simpler. Signed-off-by: Luke Kanies --- lib/puppet/node/environment.rb | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'lib/puppet/node') diff --git a/lib/puppet/node/environment.rb b/lib/puppet/node/environment.rb index 323f2793a..133f22c77 100644 --- a/lib/puppet/node/environment.rb +++ b/lib/puppet/node/environment.rb @@ -69,12 +69,8 @@ class Puppet::Node::Environment # Return all modules from this environment. # Cache the list, because it can be expensive to create. cached_attr(:modules, :ttl => Puppet[:filetimeout]) do - result = [] - Puppet::Module.each_module(modulepath) do |mod| - mod.environment = self - result << mod - end - result + module_names = modulepath.collect { |path| Dir.entries(path) }.flatten.uniq + module_names.collect { |path| Puppet::Module.new(path, self) rescue nil }.compact end def to_s -- cgit