未定义的方法get_uptime for Facter :: Util :: Uptime:Module(NoMethodError)

时间:2010-09-26 13:57:02

标签: ruby rubygems puppet facter

我正在尝试设置一个木偶节点,但rubygems似乎没有表现。

如果我通过它自己的二进制文件(/usr/lib/ruby/gems/1.8/gems/facter-1.5.8/bin/facter)在cli上运行facter,它运行正常,但如果我通过它运行它由rubygems安装的二进制文件(/ usr / bin / facter),它抛出:

/usr/lib/ruby/1.8/facter/uptime.rb:11: undefined method `get_uptime' for Facter::Util::Uptime:Module (NoMethodError)
        from /usr/lib/ruby/gems/1.8/gems/facter-1.5.8/lib/facter/util/loader.rb:73:in `load'
        from /usr/lib/ruby/gems/1.8/gems/facter-1.5.8/lib/facter/util/loader.rb:73:in `load_file'
        from /usr/lib/ruby/gems/1.8/gems/facter-1.5.8/lib/facter/util/loader.rb:38:in `load_all'
        from /usr/lib/ruby/gems/1.8/gems/facter-1.5.8/lib/facter/util/loader.rb:33:in `each'
        from /usr/lib/ruby/gems/1.8/gems/facter-1.5.8/lib/facter/util/loader.rb:33:in `load_all'
        from /usr/lib/ruby/gems/1.8/gems/facter-1.5.8/lib/facter/util/loader.rb:30:in `each'
        from /usr/lib/ruby/gems/1.8/gems/facter-1.5.8/lib/facter/util/loader.rb:30:in `load_all'
        from /usr/lib/ruby/gems/1.8/gems/facter-1.5.8/lib/facter/util/collection.rb:90:in `load_all'
        from /usr/lib/ruby/gems/1.8/gems/facter-1.5.8/lib/facter.rb:95:in `to_hash'
        from /usr/lib/ruby/gems/1.8/gems/facter-1.5.8/bin/facter:137
        from /usr/bin/facter:19:in `load'
        from /usr/bin/facter:19

我已经尝试删除rubygems并重新安装以及重新安装gem,但似乎没有任何效果。

我假设某些东西被缓存在某处,因为当我试图运行木偶时它会抛出同样的错误。

有什么想法吗?

1 个答案:

答案 0 :(得分:8)

在使用rubygems安装之前,您可能已经在rubygems之外安装了facter

您会注意到堆栈跟踪中的最终文件是/usr/lib/ruby/1.8/facter/uptime.rb,而不是/usr/lib/ruby/gems/1.8/gems/facter-1.5.8中的文件。

您应该检查/usr/lib/ruby/1.8/facter中的文件是否确实只是旧版本的因素,如果是这样,您应该能够删除它们或将它们移动到不同名称的目录,它将解决您的问题。 / p>