因此,我在“主”节点 puppetentmaster 上安装了 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-dependencies
追溯到https://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
?
答案1
您需要在 Puppet 客户端上更改源,而不是主客户端。