summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Robinson <matt@puppetlabs.com>2011-03-26 10:03:51 -0700
committerMatt Robinson <matt@puppetlabs.com>2011-03-29 10:59:25 -0700
commitbfac57a0e5e12f92c92182adae1595d4a49ca5a7 (patch)
treecdad275abb17aa4ba7dcdba77a88d870d6ca6a97
parenta520c5e3f6cbb06b5902b3021db6b024b085408a (diff)
downloadpuppet-bfac57a0e5e12f92c92182adae1595d4a49ca5a7.tar.gz
puppet-bfac57a0e5e12f92c92182adae1595d4a49ca5a7.tar.xz
puppet-bfac57a0e5e12f92c92182adae1595d4a49ca5a7.zip
(#6830) Fix File class scoping
As seen in other Ruby 1.9 compatibility patches already. Fixes errors like: undefined method `dirname' for Puppet::Type::File:Class Reviewed-by: Jesse Wolfe <jesse@puppetlabs.com>
-rwxr-xr-xlib/puppet/type/tidy.rb6
-rw-r--r--lib/puppet/type/zone.rb2
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/puppet/type/tidy.rb b/lib/puppet/type/tidy.rb
index 93a7e96cf..146481fed 100755
--- a/lib/puppet/type/tidy.rb
+++ b/lib/puppet/type/tidy.rb
@@ -254,7 +254,7 @@ Puppet::Type.newtype(:tidy) do
if parameter
files = Puppet::FileServing::Fileset.new(self[:path], parameter).files.collect do |f|
- f == "." ? self[:path] : File.join(self[:path], f)
+ f == "." ? self[:path] : ::File.join(self[:path], f)
end
else
files = [self[:path]]
@@ -270,7 +270,7 @@ Puppet::Type.newtype(:tidy) do
files_by_name = result.inject({}) { |hash, file| hash[file[:path]] = file; hash }
files_by_name.keys.sort { |a,b| b <=> b }.each do |path|
- dir = File.dirname(path)
+ dir = ::File.dirname(path)
next unless resource = files_by_name[dir]
if resource[:require]
resource[:require] << Puppet::Resource.new(:file, path)
@@ -321,7 +321,7 @@ Puppet::Type.newtype(:tidy) do
def stat(path)
begin
- File.lstat(path)
+ ::File.lstat(path)
rescue Errno::ENOENT => error
info "File does not exist"
return nil
diff --git a/lib/puppet/type/zone.rb b/lib/puppet/type/zone.rb
index 1bae93120..0fc702ccf 100644
--- a/lib/puppet/type/zone.rb
+++ b/lib/puppet/type/zone.rb
@@ -409,7 +409,7 @@ Puppet::Type.newtype(:zone) do
# both as prerequisites.
autorequire(:file) do
if @parameters.include? :path
- [@parameters[:path].value, File.dirname(@parameters[:path].value)]
+ [@parameters[:path].value, ::File.dirname(@parameters[:path].value)]
else
nil
end