我的 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 `初始化' 来自 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
知道会发生什么吗?
答案1
在我修复了处理服务器机架配置的 Puppet 模块并升级了 Puppet 之后,我现在将回答“对我有用”。我相信我可能遇到了这样一种情况:我将 config.ru 修改为提供的版本,而 Puppet 会覆盖该版本,从而导致此操作失败。
将我的 Puppet 模块和 Puppet 版本更新到 3.0.1(这可能是罪魁祸首,但我从未看到错误报告)后,现在运行良好。