diff options
| author | Luke Kanies <luke@reductivelabs.com> | 2009-12-21 16:27:34 -0800 |
|---|---|---|
| committer | Luke Kanies <luke@reductivelabs.com> | 2009-12-21 16:27:34 -0800 |
| commit | d921c459c14f7460fb209dea3b9194c91fee9fd1 (patch) | |
| tree | 44783bcb3377b25da9e9283922617e06d471f2ad /lib/puppet/node | |
| parent | 4226e018d7c8e2d52ef59edf37d3a320aa823be0 (diff) | |
| parent | 740fd6b301af89ab3aad89bca183ad1fcdc24ac4 (diff) | |
Merge branch 'merge'
Diffstat (limited to 'lib/puppet/node')
| -rw-r--r-- | lib/puppet/node/environment.rb | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/lib/puppet/node/environment.rb b/lib/puppet/node/environment.rb index 133f22c77..94f899200 100644 --- a/lib/puppet/node/environment.rb +++ b/lib/puppet/node/environment.rb @@ -55,15 +55,7 @@ class Puppet::Node::Environment if ENV["PUPPETLIB"] dirs = ENV["PUPPETLIB"].split(File::PATH_SEPARATOR) + dirs end - dirs.collect do |dir| - if dir !~ /^#{File::SEPARATOR}/ - File.join(Dir.getwd, dir) - else - dir - end - end.find_all do |p| - p =~ /^#{File::SEPARATOR}/ && FileTest.directory?(p) - end + validate_dirs(dirs) end # Return all modules from this environment. @@ -73,7 +65,26 @@ class Puppet::Node::Environment module_names.collect { |path| Puppet::Module.new(path, self) rescue nil }.compact end + # Cache the manifestdir, so that we aren't searching through + # all known directories all the time. + cached_attr(:manifestdir, :ttl => Puppet[:filetimeout]) do + validate_dirs(self[:manifestdir].split(File::PATH_SEPARATOR)) + end + def to_s name.to_s end + + def validate_dirs(dirs) + dirs.collect do |dir| + if dir !~ /^#{File::SEPARATOR}/ + File.join(Dir.getwd, dir) + else + dir + end + end.find_all do |p| + p =~ /^#{File::SEPARATOR}/ && FileTest.directory?(p) + end + end + end |
