所以我在“master”节点puppettentmaster上有了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的代码被莫名其妙地caching在某处 – 我已经重新启动了所有可以重新启动的服务,但仍然会收到--include-dependencies选项。
在使用gem提供程序时,如何强制该提供程序代码重新加载到主服务器上以取出--include-dependencies ?
您需要更改傀儡客户端上的源代码,而不是主服务器上的源代码。