diff options
| author | Josh Cooper <josh@puppetlabs.com> | 2011-08-19 14:03:56 -0700 |
|---|---|---|
| committer | Josh Cooper <josh@puppetlabs.com> | 2011-08-19 14:03:56 -0700 |
| commit | 384302af6dec8c51442f2f29a4c7c555379cd297 (patch) | |
| tree | 27680b19648100058c752e5fa4136a88a73d7a4f /lib/puppet/node | |
| parent | 71e190bf255f98e900f7ddd55db393d448df3274 (diff) | |
| parent | 2091cbeade9d69a18689609f407f9d7f0304dc04 (diff) | |
| download | puppet-384302af6dec8c51442f2f29a4c7c555379cd297.tar.gz puppet-384302af6dec8c51442f2f29a4c7c555379cd297.tar.xz puppet-384302af6dec8c51442f2f29a4c7c555379cd297.zip | |
Merge branch 'backport-windows-work-to-2.7' into 2.7.x
* backport-windows-work-to-2.7: (60 commits)
maint: Fix build break due to recent merge from 2.7.x to master
Fix posix exec provider spec failures on Windows
(#5495) Remove dead Windows-specific code from posix exec provider
Stop trying to make config directories in Windows specs
(#8272) Add missing tests for Windows service provider methods.
(#8409) Add a default group provider for Windows
(#8408) Add a default user provider for Windows
(#8408/8409) Add a Windows ADSI helper module
(#8663) Exclude exec timeout test on Windows
(#8663) Exclude git rev-parse HEAD spec test on Windows
Check for the appropriate permissions in File type tests on Windows
Remove :fails_on_windows from file type tests that no longer fail on Windows
Disable file bucket diffing tests on Windows
Always put a slash between the checksum and path in filebucket URLs
Treat Windows absolute paths as absolute paths
Consolidate test logic determining if a registered file is in the temp directory
Clarify logic and error messages when initializing Puppet::FileBucket::File
Disable symlink related file tests on Windows
(#8644) Host provider on Windows
(#8660) Fix destdir option on Windows
...
Diffstat (limited to 'lib/puppet/node')
| -rw-r--r-- | lib/puppet/node/environment.rb | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/lib/puppet/node/environment.rb b/lib/puppet/node/environment.rb index dc631979e..4fc314a6a 100644 --- a/lib/puppet/node/environment.rb +++ b/lib/puppet/node/environment.rb @@ -95,7 +95,7 @@ class Puppet::Node::Environment # Cache the modulepath, so that we aren't searching through # all known directories all the time. - cached_attr(:modulepath, :ttl => Puppet[:filetimeout]) do + cached_attr(:modulepath, Puppet[:filetimeout]) do dirs = self[:modulepath].split(File::PATH_SEPARATOR) dirs = ENV["PUPPETLIB"].split(File::PATH_SEPARATOR) + dirs if ENV["PUPPETLIB"] validate_dirs(dirs) @@ -103,7 +103,7 @@ 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 + cached_attr(:modules, Puppet[:filetimeout]) do module_names = modulepath.collect { |path| Dir.entries(path) }.flatten.uniq module_names.collect do |path| begin @@ -114,12 +114,6 @@ class Puppet::Node::Environment end.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 @@ -136,14 +130,18 @@ class Puppet::Node::Environment end def validate_dirs(dirs) + dir_regex = Puppet.features.microsoft_windows? ? /^[A-Za-z]:#{File::SEPARATOR}/ : /^#{File::SEPARATOR}/ + # REMIND: Dir.getwd on windows returns a path containing backslashes, which when joined with + # dir containing forward slashes, breaks our regex matching. In general, path validation needs + # to be refactored which will be handled in a future commit. dirs.collect do |dir| - if dir !~ /^#{File::SEPARATOR}/ - File.join(Dir.getwd, dir) + if dir !~ dir_regex + File.expand_path(File.join(Dir.getwd, dir)) else dir end end.find_all do |p| - p =~ /^#{File::SEPARATOR}/ && FileTest.directory?(p) + p =~ dir_regex && FileTest.directory?(p) end end |
