Puppet

重新載入 Puppet gem 提供程序源

  • February 2, 2014

所以我在“主”節點 puppetmaster 上安裝了 Puppet Enterprise 2.7。在製定在“客戶端”節點上安裝 Ruby 2.0 的新方法時,我注意到如果我強制客戶端開始使用 gem 2.0,我會遇到如下錯誤:

err: /Stage[main]/_ruby::Mysql_gem/Package[mysql]/ensure: change from absent to 2.8.1 failed: Could not update: Execution of '/usr/bin/gem install -v 2.8.1 --include-dependencies --no-rdoc --no-ri mysql' returned 1: ERROR:  While executing gem ... (OptionParser::InvalidOption)
   invalid option: --include-dependencies
at /etc/puppetlabs/puppet/environments/ci/modules/_ruby/manifests/mysql_gem.pp:29

我追踪--include-dependencieshttps://github.com/puppetlabs/puppet/commit/2284e837939628f81149e62fdc0f314ff077a776,它已經被刪除了,所以我從我的 Puppet 提供程式碼中刪除了它/opt/puppet/lib/site_ruby/1.8/puppet/provider/package/gem.rb

 def install(useversion = true)
   command = [command(:gemcmd), "install"]
   command << "-v" << resource[:ensure] if (! resource[:ensure].is_a? Symbol) and useversion
   # JOE HAS BEEN HERE - see http://projects.puppetlabs.com/issues/19741,
   # https://github.com/puppetlabs/puppet/commit/2284e837939628f81149e62fdc0f314ff077a776
   # Always include dependencies
   # command << "--include-dependencies"

不幸的是,程式碼gem.rb莫名其妙地記憶體在某處-我已經重新啟動了我認為重新啟動的所有服務,但無濟於事,我仍然可以--include-dependencies選擇包含在內。

--include-dependencies在使用提供程序時,如何強制將提供程式碼重新載入到主伺服器上以取出gem

您需要更改 puppet 客戶端上的源,而不是 master。

引用自:https://serverfault.com/questions/571553