![Puppet 无法在多 Ruby 版本环境中与 augeas 协同工作](https://linux22.com/image/665882/Puppet%20%E6%97%A0%E6%B3%95%E5%9C%A8%E5%A4%9A%20Ruby%20%E7%89%88%E6%9C%AC%E7%8E%AF%E5%A2%83%E4%B8%AD%E4%B8%8E%20augeas%20%E5%8D%8F%E5%90%8C%E5%B7%A5%E4%BD%9C.png)
我正在尝试让 puppet 与 augeas 一起工作,但它抱怨没有 augeas 提供商。一些谷歌搜索建议
sudo yum install augeas
augtool ls /files/etc/php.ini # test it works as expected
sudo yum install ruby-augeas # this is to "bridge" ruby and augeas
ruby -raugeas -e "puts Augeas.open" # Test ruby can talk to augeas
/usr/local/rvm/rubies/ruby-2.0.0-p451/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- augeas (LoadError)
from /usr/local/rvm/rubies/ruby-2.0.0-p451/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
除了最后一行之外,一切都正常并且安装成功。Ruby 只是不知道在哪里可以找到 augeas.rb,因为它不在 ruby 包含路径中
[vagrant@SubscriptionsAPI ~]$ sudo find / -name "augeas.rb"
/usr/local/rvm/gems/ruby-2.0.0-p451/gems/puppet-3.4.3/lib/puppet/provider/augeas/augeas.rb
/usr/local/rvm/gems/ruby-2.0.0-p451/gems/puppet-3.4.3/lib/puppet/type/augeas.rb
/usr/lib/ruby/site_ruby/1.8/augeas.rb
[vagrant@SubscriptionsAPI ~]$ ruby -e 'puts $:'
/usr/local/rvm/rubies/ruby-2.0.0-p451/lib/ruby/site_ruby/2.0.0
/usr/local/rvm/rubies/ruby-2.0.0-p451/lib/ruby/site_ruby/2.0.0/x86_64-linux
/usr/local/rvm/rubies/ruby-2.0.0-p451/lib/ruby/site_ruby
/usr/local/rvm/rubies/ruby-2.0.0-p451/lib/ruby/vendor_ruby/2.0.0
/usr/local/rvm/rubies/ruby-2.0.0-p451/lib/ruby/vendor_ruby/2.0.0/x86_64-linux
/usr/local/rvm/rubies/ruby-2.0.0-p451/lib/ruby/vendor_ruby
/usr/local/rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0
/usr/local/rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/x86_64-linuxе
我这样认为对吗?如果是,我该如何为特定的 Ruby 版本安装 augeas?或者修改 ruby 包含路径是否更简洁?
答案1
打包的 ruby 库和 RVM 是两个独立的环境。您不能这样混合使用它们,您需要选择使用哪一个。
因此您需要:
- 使用包安装 ruby Augeas 绑定
- 或者在 RVM 中安装 Puppet