Re: [Puppet Users] Re: Announce: Facter 2.0.1

124 views
Skip to first unread message

Jeff McCune

unread,
Apr 2, 2014, 12:04:48 PM4/2/14
to puppet...@googlegroups.com, puppe...@googlegroups.com, puppet-...@googlegroups.com, puppet...@googlegroups.com
For those that are getting the undefined method errors, could you please run with --debug and --trace and paste the results so we could see a bit more information about where those methods are called from?

Thanks,
-Jeff
-Jeff


On Wed, Apr 2, 2014 at 7:50 AM, Stefan Wiederoder <stefanwi...@googlemail.com> wrote:

we´ve had trouble with the new version too:

[root@zoe ~]# facter
undefined method `kernel' for Facter:Module


result was a downgraded to 1.7.5-1

RHEL6-64 with
ruby: 1.8.7.352
puppet: 3.4.3

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/e43da920-62a8-4c79-b039-77a10dca927d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Eric Sorenson

unread,
Apr 2, 2014, 12:07:58 PM4/2/14
to puppet...@googlegroups.com, puppet-...@googlegroups.com, puppe...@googlegroups.com
Hi to both Stefan and DJE - these problems usually come up when there are multiple versions of facter installed, i.e. one via gem and one via RPM/deb. Can you verify this is the case? Run with --trace and do something like 'find / -name facter -type d' (hopefully with some smarter options if you have nfs mounts :) ) to see if there is another library directory that is getting picked up. Thanks!

--eric0

Madd Sauer

unread,
Jul 31, 2014, 8:08:18 AM7/31/14
to puppe...@googlegroups.com, puppet...@googlegroups.com, puppet-...@googlegroups.com
Hello Jeff,

I am a coworker of Stefan.

root@devel69 facts.d]# facter --debug --trace
Not an EC2 host
undefined method `kernel' for Facter:Module
/var/lib/puppet/lib/facter/kis_horcm.rb:5:in `
<top (required)>'
/usr/share/ruby/vendor_ruby/facter/util/loader.rb:115:in `load'

/usr/share/ruby/vendor_ruby/facter/util/loader.rb:115:in `load_file'
/usr/share/ruby/vendor_ruby/facter/util/loader.rb:49:in `
block (2 levels) in load_all'
/usr/share/ruby/vendor_ruby/facter/util/loader.rb:47:in `each'

/usr/share/ruby/vendor_ruby/facter/util/loader.rb:47:in `block in load_all'
/usr/share/ruby/vendor_ruby/facter/util/loader.rb:45:in `
each'
/usr/share/ruby/vendor_ruby/facter/util/loader.rb:45:in `load_all'

/usr/share/ruby/vendor_ruby/facter/util/collection.rb:104:in `load_all'
/usr/share/ruby/vendor_ruby/facter.rb:126:in `
to_hash'
/usr/share/ruby/vendor_ruby/facter/application.rb:46:in `run'

/usr/bin/facter:16:in `<main>'

[root@devel69 facts.d]# cat /var/lib/puppet/lib/facter/kis_horcm.rb
if Facter.kernel == "Linux"
    Facter.add("kis_horcm") do
        setcode do
            File.exist?("/etc/horcm.conf")
       end
    end
end


We got this on #RHEL6 and #RHEL7

[root@devel69 facts.d]# rpm -qa | grep facter
facter
-2.0.1-1.el7.x86_64

I checked if facter module 'kernel' is present

[root@devel69 facter]# cat /usr/share/ruby/vendor_ruby/facter/kernel.rb
# Fact: kernel
#
# Purpose: Returns the operating system's name.
#
# Resolution:
#   Uses Ruby's rbconfig to find host_os, if that is a Windows derivative, the
#   returns 'windows', otherwise returns "uname -s" verbatim.
#
# Caveats:
#

Facter.add(:kernel) do
  setcode
do
   
require 'facter/util/config'

   
if Facter::Util::Config.is_windows?
     
'windows'
   
else
     
Facter::Core::Execution.exec("uname -s")
   
end
 
end
end

so this looks good.

I also checkd 'uname'

[root@devel69 facter]# uname -s
Linux

Madd Sauer

unread,
Jul 31, 2014, 9:54:00 AM7/31/14
to puppe...@googlegroups.com, puppet...@googlegroups.com, puppet-...@googlegroups.com
Hello again,

I found out that something has changed in way how facter elements has to use.

old style

if Facter.kernel == "Linux"

new style

if Facter.kernel => :Linux

I think iI have to check some of our scripts ...

sorry for making noise here ...

Kylo Ginsberg

unread,
Jul 31, 2014, 4:05:28 PM7/31/14
to puppe...@googlegroups.com, puppet...@googlegroups.com
Hi Madd,

On Thu, Jul 31, 2014 at 5:08 AM, Madd Sauer <madd...@googlemail.com> wrote:
[root@devel69 facts.d]# cat /var/lib/puppet/lib/facter/kis_horcm.rb
if Facter.kernel == "Linux"
    Facter.add("kis_horcm") do
        setcode do
            File.exist?("/etc/horcm.conf")
       end
    end
end



One other idea: try changing Facter.kernel to Facter.value(:kernel). The former syntax was deprecated, and the latter works with older facter versions as well.

Kylo
--
Kylo Ginsberg

Join us at PuppetConf 2014September 20-24 in San Francisco
Register by July 31st to take advantage of the Early Bird discount save $249!
Reply all
Reply to author
Forward
0 new messages