diff options
| author | Josh Cooper <josh@puppetlabs.com> | 2011-07-18 22:44:10 -0700 |
|---|---|---|
| committer | Josh Cooper <josh@puppetlabs.com> | 2011-07-19 14:03:42 -0700 |
| commit | 45ae5b4a9ced26dfcd3e324391f9a26cb02bf93d (patch) | |
| tree | b61ccc5270617529b3e7113b2356f882ab53cb38 /lib/puppet/node | |
| parent | 26ee468e8b963d63933d9a27a65d55510ff87618 (diff) | |
| download | puppet-45ae5b4a9ced26dfcd3e324391f9a26cb02bf93d.tar.gz puppet-45ae5b4a9ced26dfcd3e324391f9a26cb02bf93d.tar.xz puppet-45ae5b4a9ced26dfcd3e324391f9a26cb02bf93d.zip | |
(#8268) Require windows drive letters in absolute file paths
When testing whether a file path is absolute, the regexp was only
handling POSIX style file paths. This commit requires Windows
style file paths to start with a drive letter. A future commit
will refacter the various places we do path validation to
support both Windows drive letters and UNC paths.
Reviewed-by: Jacob Helwig <jacob@puppetlabs.com>
Diffstat (limited to 'lib/puppet/node')
| -rw-r--r-- | lib/puppet/node/environment.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/puppet/node/environment.rb b/lib/puppet/node/environment.rb index dc631979e..96fdc3c1e 100644 --- a/lib/puppet/node/environment.rb +++ b/lib/puppet/node/environment.rb @@ -136,14 +136,15 @@ class Puppet::Node::Environment end def validate_dirs(dirs) + dir_regex = Puppet.features.microsoft_windows? ? /^[A-Za-z]:#{File::SEPARATOR}/ : /^#{File::SEPARATOR}/ dirs.collect do |dir| - if dir !~ /^#{File::SEPARATOR}/ + if dir !~ dir_regex 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 |
