Issue #11281 has been updated by Alexander Piavlo.

The following patch against 2.7.9 fixes the problem with ruby 1.9.2p290
Can this be applied upstream?

--- lib/puppet/type/yumrepo.rb.orig     2012-01-07 23:40:47.000000000 +0000
+++ lib/puppet/type/yumrepo.rb  2012-01-07 23:43:06.000000000 +0000
@@ -112,11 +112,11 @@
         reposdir.gsub!(/[\n,]/, " ")
         reposdir.split.each do |dir|
           Dir::glob("#{dir}/*.repo").each do |file|
-            @inifile.read(file) if File.file?(file)
+            @inifile.read(file) if ::File.file?(file)
           end
         end
         reposdir.split.each do |dir|
-          if File::directory?(dir) && File::writable?(dir)
+          if ::File.directory?(dir) && ::File.writable?(dir)
             @defaultrepodir = dir
             break
           end
@@ -138,12 +138,12 @@
       reposdir.gsub!(/[\n,]/, " ")
       reposdir.split.each do |dir|
         Dir::glob("#{dir}/*.repo").each do |file|
-          result.read(file) if File.file?(file)
+          result.read(file) if ::File.file?(file)
         end
       end
       if @defaultrepodir.nil?
         reposdir.split.each do |dir|
-          if File::directory?(dir) && File::writable?(dir)
+          if ::File.directory?(dir) && ::File.writable?(dir)
             @defaultrepodir = dir
             break
           end
@@ -159,7 +159,7 @@
       if result.nil?
         # Brand new section
         path = yumconf
-        path = File::join(@defaultrepodir, "#{name}.repo") unless 
@defaultrepodir.nil?
+        path = ::File.join(@defaultrepodir, "#{name}.repo") unless 
@defaultrepodir.nil?
         Puppet::info "create new repo #{name} in file #{path}"
         result = inifile.add_section(name, path)
       end
@@ -172,10 +172,10 @@
       unless Puppet[:noop]
         target_mode = 0644 # FIXME: should be configurable
         inifile.each_file do |file|
-          current_mode = File.stat(file).mode & 0777
+          current_mode = ::File.stat(file).mode & 0777
           unless current_mode == target_mode
             Puppet::info "changing mode of #{file} from %03o to %03o" % 
[current_mode, target_mode]
-            File.chmod(target_mode, file)
+            ::File.chmod(target_mode, file)
           end
         end
       end
----------------------------------------
Bug #11281: undefined method `file?' for Puppet::Type::File:Class
https://projects.puppetlabs.com/issues/11281

Author: Remi Broemeling
Status: Accepted
Priority: Normal
Assignee: 
Category: 
Target version: 2.7.x
Affected Puppet version: 2.7.6
Keywords: 
Branch: 


I am attempting to run puppet (v2.7.6) and facter (v1.6.1) on Ruby 1.9.2p290, 
and I am unable to execute against my manifests.  The exact same manifests are 
working on Ruby Enterprise Edition 1.8.7 (2011-02-18 patchlevel 334).  The 
error that I am receiving is as follows:

`** [out :: rubytest...] err: /Stage[main]//Yumrepo[yum_puppet_repo]: Could not 
evaluate: undefined method 'file?' for Puppet::Type::File:Class`

The yum_puppet_repo stanza looks like this:

`exec { "yum_rebuild_cache":
  command => "/usr/bin/yum makecache",
  logoutput => false,
  refreshonly => true
}`

`yumrepo { "yum_puppet_repo":
  baseurl => "file://${puppet_root}/../RPM/RPMS",
  descr => "Local package repository.",
  enabled => 1,
  gpgcheck => 0,
  notify => Exec["yum_rebuild_cache"]
}`

I believe this to be a bug in puppet (and not in my manifest) wholly because 
the same puppet configuration works properly on Ruby Enterprise Edition.

Is there further information that I can give to help debug this issue?



-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to