diff options
Diffstat (limited to 'lib/puppet')
| -rw-r--r-- | lib/puppet/type/file.rb | 3 | ||||
| -rw-r--r-- | lib/puppet/util/command_line.rb | 2 | ||||
| -rw-r--r-- | lib/puppet/util/settings/file_setting.rb | 6 |
3 files changed, 6 insertions, 5 deletions
diff --git a/lib/puppet/type/file.rb b/lib/puppet/type/file.rb index 2e249ad41..51865ef49 100644 --- a/lib/puppet/type/file.rb +++ b/lib/puppet/type/file.rb @@ -29,7 +29,8 @@ Puppet::Type.newtype(:file) do isnamevar validate do |value| - unless value =~ /^#{File::SEPARATOR}/ + # use underlying platform's convention to check for relative paths + unless File.expand_path(value) == value fail Puppet::Error,"File paths must be fully qualified, not '#{value}'" end end diff --git a/lib/puppet/util/command_line.rb b/lib/puppet/util/command_line.rb index 9003a0c1a..8a010bb76 100644 --- a/lib/puppet/util/command_line.rb +++ b/lib/puppet/util/command_line.rb @@ -62,7 +62,7 @@ module Puppet private def subcommand_and_args( zero, argv, stdin ) - zero = zero.gsub(/.*#{File::SEPARATOR}/,'').sub(/\.rb$/, '') + zero = File.basename(zero, '.rb') if zero == 'puppet' case argv.first diff --git a/lib/puppet/util/settings/file_setting.rb b/lib/puppet/util/settings/file_setting.rb index 2dfbcf46e..732af0b09 100644 --- a/lib/puppet/util/settings/file_setting.rb +++ b/lib/puppet/util/settings/file_setting.rb @@ -49,9 +49,9 @@ class Puppet::Util::Settings::FileSetting < Puppet::Util::Settings::Setting # the variable 'dir', or adding a slash at the end. def munge(value) # If it's not a fully qualified path... - if value.is_a?(String) and value !~ /^\$/ and value !~ /^\// and value != 'false' + if value.is_a?(String) and value !~ /^\$/ and value != 'false' # Make it one - value = File.join(Dir.getwd, value) + value = File.expand_path(value) end if value.to_s =~ /\/$/ @type = :directory @@ -83,7 +83,7 @@ class Puppet::Util::Settings::FileSetting < Puppet::Util::Settings::Setting return nil unless path.is_a?(String) # Make sure the paths are fully qualified. - path = File.join(Dir.getwd, path) unless path =~ /^\// + path = File.expand_path(path) return nil unless type == :directory or create_files? or File.exist?(path) return nil if path =~ /^\/dev/ |
