我正在尝试在 ubuntu 12.04 中安装 foreman,添加 apt 源并执行 foreman-installer 命令后出现以下错误。
/usr/lib/ruby/vendor_ruby/kafo/puppet_module_parser.rb:21:in `initialize': uninitialized constant Puppet::Parser::Parser (NameError)
在谷歌上找不到太多信息....
如何解决?
我按照本教程安装了 Puppet Master 和 Puppet Agent
https://coderwall.com/p/w6oxug/puppet-installation-on-ubuntu-12-04lts
一切都运行正常,直到我卸载 ruby、rvm、gem、bundler 等,并全新安装 rvm、将 ruby 更新至 2.3.0。
我将 ruby 更新到 2.3.0,更新了 gem、bundlet……但是如果我输入 puppet -V,就会出现以下错误
sudo 服务 puppet 启动
- 启动 puppet 代理 /usr/bin/puppet:3:in `require': 没有要加载的文件 -- puppet/util/command_line (LoadError) 从 /usr/bin/puppet:3
宝石环境:
RubyGems Environment:
- RUBYGEMS VERSION: 2.5.1
- RUBY VERSION: 2.3.0 (2015-12-25 patchlevel 0) [x86_64-linux]
- INSTALLATION DIRECTORY: /usr/share/rvm/gems/ruby-2.3.0
- USER INSTALLATION DIRECTORY: /home/user/.gem/ruby/2.3.0
- RUBY EXECUTABLE: /usr/share/rvm/rubies/ruby-2.3.0/bin/ruby
- EXECUTABLE DIRECTORY: /usr/share/rvm/gems/ruby-2.3.0/bin
- SPEC CACHE DIRECTORY: /home/user/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /usr/share/rvm/gems/ruby-2.3.0
- /usr/share/rvm/gems/ruby-2.3.0@global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/share/rvm/gems/ruby-2.3.0/bin
- /usr/share/rvm/gems/ruby-2.3.0@global/bin
- /usr/share/rvm/rubies/ruby-2.3.0/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
- /usr/lib/jvm/jdk1.7/bin
- /home/glassfish/bin
- /usr/share/rvm/bin
- /home/user/.rvm/bin
- /home/user/.rvm/bin
更新2:
rvm -v rvm 1.27.0 (最新版),作者:Wayne E. Seguin、Michal Papis [https://rvm.io/]
ruby -v ruby 2.3.0p0(2015-12-25 修订版 53290)[x86_64-linux]
rails -v Rails 5.0.0.1
宝石-v 2.6.6
哪个红宝石
/home/用户/.rvm/rubies/ruby-2.3.0/bin/ruby
哪些轨道
/home/user/.rvm/gems/ruby-2.3.0/bin/rails
哪颗宝石
/home/user/.rvm/rubies/ruby-2.3.0/bin/gem
更新 3:
工头安装工
文件 /var/log/foreman-installer/foreman-installer.log 不可写,不会将任何内容记录到文件中!/home/user/.rvm/gems/ruby-2.3.0/gems/kafo-0.9.4/lib/kafo/puppet_module.rb:69:in `parse': 未安装 Puppet 模块解析器,并且没有可用的文件 /usr/share/foreman-installer/modules/foreman/manifests/init.pp 缓存。请检查调试日志并为解析器安装可选依赖项。(Kafo::ParserError)
更新 4:
几乎接近完成安装:
我使用的是 puppet 4 gem,这导致了 UPDATE 3 错误。我将 puppet 降级到 3.7 版,并重新安装了 highline 和 kafo gems
gem 安装 puppet-v 3.7
宝石安装高线
宝石安装 kafo
然后尝试
工头安装工
准备安装完成
出了点问题!检查日志中的错误级别输出 完整日志位于 /var/log/foreman-installer/foreman-installer.log
在日志中,我可以看到这些错误,
[ERROR 2016-08-30T08:13:17 main] Errors encountered during run:
[ERROR 2016-08-30T08:13:17 main] Could not autoload puppet/parser/functions/add_progress: cannot load such file -- kafo/modules/kafo_configure/lib/kafo/puppet/report$
[ERROR 2016-08-30T08:13:17 main] Could not autoload puppet/parser/functions/add_progress: cannot load such file -- kafo/modules/kafo_configure/lib/kafo/puppet/report$
[ERROR 2016-08-30T08:13:17 main] Could not autoload puppet/parser/functions/add_progress: cannot load such file -- kafo/modules/kafo_configure/lib/kafo/puppet/report$
Could not autoload puppet/parser/functions/add_progress: cannot load such file -- kafo/modules/kafo_configure/lib/kafo/puppet/report_wrapper
当前系统配置
rails -v
Rails 4.2.2
ruby -v
ruby 2.0.0p648 (2015-12-16 revision 53162) [x86_64-linux]
gem -v
2.4.8
bundler -v
Bundler version 1.12.5
puppet -V
3.7.0
上述错误适用于 foreman-installer 1.4 和 1.7,
当我尝试 1.3 安装程序时,
'uninitialized constant Kafo::KafoConfigure (NameError) '
更新 5: 我现在可以得出一个结论......
It's all about finding the
right puppet version,
right kafo version,
right foreman-installer,
right ruby version and
right gem version for ubuntu 12.04
IF anyone succeeded in installing foreman-installer 1.4 in ubuntu 12.04, please give me the version no for all above mentioned
答案1
正如我在最初的问题中提到的,在 Ubuntu 12.04 中,一切都是为了满足 forman-installer、ruby、puppet、kafo、kafo_parsers、rails 和 gem 的正确配置。
这是最终对我有用的配置。
- foreman-installer 1.7
- ruby-v 2.1.1
- rails -v 4.2.2
- 木偶-V 3.8.7
- kafo-v 0.9.4
- kafo_parsers-v 0.1.2
- 宝石-v 2.6.6
当你更改 ruby 版本时,请确保更新 gems,再次安装 puppet gem 和其他所需的 gems ( highline )
gem update --system
gem install highline
gem install puppet -v 3.8.7
另外,请确保您已更新以下 foreman 内容。如果您已经安装了 foreman 旧安装程序,则必须先将其删除
sudo apt-get remove foreman-installer
运行此命令“ sudo nano /etc/apt/sources.list.d/foreman.list
”并使用此条目更新文件,deb http://deb.theforeman.org/ precise 1.7
然后运行以下命令,
sudo apt-get update
sudo apt-get install foreman-installer
foreman-installer
这是最终的配置,最终对我有用。现在我正在努力更改 foreman 端口 :)