我的 Puppet master 使用 Passenger 来服务。升级到 Puppet 3.0.0 后出现以下错误:
[ pid=17576 thr=70231398486460 file=utils.rb:176 time=2012-10-01 17:37:12.892 ]: *** PhusionPassenger::Rack::ApplicationSpawner 中的异常 NoMethodError(未定义的方法`-@' 用于“ master":String)(进程 17576,线程 #): 来自 config.ru:7 来自 /usr/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval' 来自 /usr/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize' 来自 config.ru:1:in `new' 来自 config.ru:1
我的config.ru如下:
# a config.ru, for use with every rack-compatible webserver.
# SSL needs to be handled outside this, though.
# if puppet is not in your RUBYLIB:
# $LOAD_PATH.unshift('/opt/puppet/lib')
$0 = "master"
# if you want debugging:
# ARGV << "--debug"
ARGV << "--rack"
# Rack applications typically don't start as root. Set --confdir to prevent
# reading configuration from ~/.puppet/puppet.conf
ARGV << "--confdir" << "/etc/puppet"
# NOTE: it's unfortunate that we have to use the "CommandLine" class
# here to launch the app, but it contains some initialization logic
# (such as triggering the parsing of the config file) that is very
# important. We should do something less nasty here when we've
# gotten our API and settings initialization logic cleaned up.
#
# Also note that the "$0 = master" line up near the top here is
# the magic that allows the CommandLine class to know that it's
# supposed to be running master.
#
# --cprice 2012-05-22
require 'puppet/util/command_line'
# we're usually running inside a Rack::Builder.new {} block,
# therefore we need to call run *here*.
run Puppet::Util::CommandLine.new.execute
知道会发生什么吗?
在我修复了处理服务器机架配置的 Puppet 模块并升级了 Puppet 之后,我现在将回答“对我有用”。我相信我可能遇到过这样一种情况,即我将 config.ru 修改为提供的版本,而 Puppet 会覆盖该版本导致失败。
将我的 Puppet 模块和 Puppet 版本更新到 3.0.1 后(这可能是罪魁祸首,但我从未看到错误报告),现在工作正常。