呼叫失败()失败

时间:2017-08-02 14:38:54

标签: puppet

我正在尝试设置一个新的puppetmaster(v5.0.1)并且一切顺利,除了一件事。

我无法在我的清单中致电fail()。当它尝试运行任何fail()函数时,会抛出评估错误。

这种情况发生在清单中,并且木偶也适用。

$ puppet apply -e 'fail("Failure")' --trace

将返回以下错误和跟踪:

  

错误:评估错误:评估函数调用时出错,   节点上的第1:1行失败***   /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/functions/fail.rb:3:in   新功能block in <top (required)>' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/functions.rb:174:in 阻止(2级)   /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in   profile' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler.rb:51:in 轮廓”   /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/functions.rb:167:in   block in newfunction' :1:in栈”   /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/puppet_stack.rb:30:in   eval' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/puppet_stack.rb:30:in 栈”   /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/evaluator/runtime3_support.rb:316:in   call_function' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/evaluator/evaluator_impl.rb:949:in call_function_with_block”   /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/evaluator/evaluator_impl.rb:918:in   eval_CallNamedFunctionExpression' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/visitor.rb:48:in 阻止访问_this'   /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/visitor.rb:42:in   each' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/visitor.rb:42:in visit_this'   /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/visitor.rb:92:in   visit_this_1' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/evaluator/evaluator_impl.rb:81:in 评估':stack' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/puppet_stack.rb:30:in eval'   /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/puppet_stack.rb:30:in   stack' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/evaluator/evaluator_impl.rb:723:in eval_Program”   /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/visitor.rb:48:in   block in visit_this' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/visitor.rb:42:in 每个”   /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/visitor.rb:42:in   visit_this' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/visitor.rb:92:in visit_this_1'   /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/evaluator/evaluator_impl.rb:81:in   evaluate' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/parser/evaluating_parser.rb:63:in 评价”   /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/ast/pops_bridge.rb:132:in   evaluate' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/ast.rb:31:in safeevaluate”   /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource/type.rb:136:in   evaluate_code' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/resource.rb:79:in 阻止评估'   /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in   profile' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler.rb:51:in 轮廓”   /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/resource.rb:71:in   evaluate' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:589:in evaluate_main'   /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:164:in   block (2 levels) in compile' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in 轮廓”   /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler.rb:51:in   profile' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:164:in 阻止编译'   /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/context.rb:65:in   override' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb:310:in 覆盖”   /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:153:in   compile' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:33:in 编译”   /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:282:in   block (2 levels) in compile' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in 轮廓”   /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler.rb:51:in   profile' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:280:in 阻止编译'   /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:224:in   block in benchmark' /opt/puppetlabs/puppet/lib/ruby/2.4.0/benchmark.rb:308:in实时”   /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:223:in   benchmark' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:278:in 编译”   /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:52:in   find' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/indirection.rb:195:in 找到”   /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/apply.rb:258:in   block in main' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/context.rb:65:in 覆盖”   /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb:310:in   override' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/apply.rb:229:in 主   /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/apply.rb:170:in   run_command' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:358:in 阻止运行'   /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:666:in   exit_on_fail' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:358:in 运行”   /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:132:in   run' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:72:in 执行'/ opt / puppetlabs / puppet / bin / puppet:5:in''

我确定是我,但我无法弄清楚是什么导致了这一点。

1 个答案:

答案 0 :(得分:2)

fail()函数按设计工作,但错误信息令人困惑。

fail()函数只是raise Puppet::ParseError的包装。通常情况下,当Puppet函数执行它应该执行的操作时,会引发Puppet::ParseError。在这种情况下,消息Error while evaluating a Function Call是有道理的。

然而,这里出现错误,因为函数正在执行 应该做的事情 - 为您引发错误。因此,在评估函数调用时,这不是一个错误&#34;。

虽然一直都是这样。