我正在try 使用puppetforge puppet-r10k r10k上的模块来部署r10k,但是当我运行puppetforge puppet agent-t时,似乎该模块得到了安装在机器上的错误版本.错误:

Error: Execution of '/opt/puppetlabs/puppet/bin/gem install --no-document --no-document r10k' returned 1: ERROR:  Error installing r10k:
    The last version of faraday-net_http (>= 2.0, < 3.2) to support your Ruby & RubyGems was 3.0.2. Try installing it with `gem install faraday-net_http -v 3.0.2` and then running the current command again
    faraday-net_http requires Ruby version >= 3.0.0. The current ruby version is 2.7.8.225.
Error: /Stage[main]/R10k::Install/Package[r10k]/ensure: change from 'absent' to 'present' failed: Execution of '/opt/puppetlabs/puppet/bin/gem install --no-document --no-document r10k' returned 1: ERROR:  Error installing r10k:
    The last version of faraday-net_http (>= 2.0, < 3.2) to support your Ruby & RubyGems was 3.0.2. Try installing it with `gem install faraday-net_http -v 3.0.2` and then running the current command again
    faraday-net_http requires Ruby version >= 3.0.0. The current ruby version is 2.7.8.225.

计算机上的当前版本:

root@mpuppetserver:~# ruby -v
ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux-gnu]

我试图安装(正如他所说的)Faraday-Net_http-v 3.0.2,但这并没有解决问题. 无论如何,我try 添加不同的源代码和远程存储库(Hiera):

r10k::sources:
  preprod:
    remote: "%{lookup('git_preprod')}"
    basedir: "${::settings::codedir}/environments"
    prefix: false

它似乎能够跳过错误并将数据添加到文件/etc/puppetlabs/r10 k/r10k.yaml中:

root@puppetserver:~# cat /etc/puppetlabs/r10k/r10k.yaml
---
pool_size: 6
deploy:
  generate_types: true
  exclude_spec: true
cachedir: "/opt/puppetlabs/puppet/cache/r10k"
sources:
  preprod:
    remote: git@blabla/bla.git
    basedir: "${::settings::codedir}/environments"
    prefix: false

顺便说一句,错误仍然存在,没有安装r10k gem.

谢谢.

推荐答案

Gem必须与Pupket服务器的C/MRI解释器Ruby安装一起安装,而不是Ruby的系统安装,也不是JRuby Pupket服务器安装:

/opt/puppetlabs/puppet/bin/gem install --no-document faraday-net_http -v 3.0.2

这将解决错误,您将能够继续.

Ruby相关问答推荐

Ruby 扁平化 JSON 对象或哈希

如何在不将换行符粘贴到字符串中的情况下使用puts添加额外的换行符?

给url添加参数

哈希或其他对象的内存大小?

Windows 上的 Jekyll:Pygments 不工作

为什么 Ruby 中的 `a = a` `nil`?

Ruby on Rails 中是否有简写 if(没有 else)语句?

将一个目录的内容复制到另一个目录

如何判断 Capistrano 中是否存在文件(在远程服务器上)?

根据另一个数组的元素对数组进行排序

以条件方式构建哈希

class_eval、class_exec、module_eval 和 module_exec 有什么区别?

理解 Ruby 中的私有方法

如何在没有 Rails 的情况下使用 RSpec?

相当于 Ruby 中的通过

你怎么说不等于在 Ruby 中?

Ruby 删除目录

Ruby on Rails switch

Ruby:如何为数组和哈希制作 IRB 打印 struct

JavaScript Array:获取项目的范围