diff options
| author | Luke Kanies <luke@reductivelabs.com> | 2009-12-21 16:23:44 -0800 |
|---|---|---|
| committer | Luke Kanies <luke@reductivelabs.com> | 2009-12-21 16:23:44 -0800 |
| commit | 740fd6b301af89ab3aad89bca183ad1fcdc24ac4 (patch) | |
| tree | f34617a229509c373d28d67abb453e7ae2136c39 /lib/puppet/node | |
| parent | 8971d8beae2c409f9052f27c3f80ad3bdfff4de2 (diff) | |
| parent | 4a06379f8770c164e42bcc410d874076c6e95f24 (diff) | |
Merge branch '0.25.x'
Conflicts:
lib/puppet/agent.rb
lib/puppet/application/puppetd.rb
lib/puppet/parser/ast/leaf.rb
lib/puppet/util/rdoc/parser.rb
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 |
